Html ';必需的';属性不工作
我最近创建了一个网页,让我了解更多关于HTML的信息,我找到了Html ';必需的';属性不工作,html,Html,我最近创建了一个网页,让我了解更多关于HTML的信息,我找到了“required”属性。我把它添加到字段中,但它什么也没做 有人能告诉我我对“必选”属性的错误吗 当字段为空时,我希望它显示“请填写此字段” <html> <head> <link href="icon.ico" rel="icon"> <title>Log In</title> </he
“required”
属性。我把它添加到字段中,但它什么也没做
有人能告诉我我对“必选”属性的错误吗
当字段为空时,我希望它显示“请填写此字段”
<html>
<head>
<link href="icon.ico" rel="icon">
<title>Log In</title>
</head>
<body>
<h1 align="center">Welcome to site</h1>
<hr width="50%"/>
<br/>
<table align="center">
<form>
<tr>
<td>Log In : </td>
<td><input type="text" name="LogInEmail" placeholder="Enter your email" required></td> </tr><tr>
<td>Password : </td>
<td><input type="password" name="password" placeholder="Password" required></td>
</tr>
</form>
</table>
<br/>
<table align="center">
<form>
<tr>
<td><input type="submit" value=" Log In "/></td>
</tr>
</form>
</table>
</body>
</html>
登录
欢迎来到我们的网站
登录:
密码:
请确保您已在第一张表格中提交。
你有多种形式。因此,所需的功能不起作用
<html>
<head>
<link href="icon.ico" rel="icon">
<title>Log In</title>
</head>
<body>
<h1 align="center">Welcome to site</h1>
<hr width="50%" />
<br/>
<table align="center">
<form id="form1" runat="server">
<tr>
<td>Log In : </td>
<td>
<input type="text" name="LogInEmail" placeholder="Enter your email" required>
</td>
</tr>
<tr>
<td>Password : </td>
<td>
<input type="password" name="password" placeholder="Password" required>
</td>
</tr>
<tr>
<td>
<input type="submit" value=" Log In " />
</td>
</tr>
</form>
</table>
</body>
</html>
登录
欢迎来到我们的网站
登录:
密码:
但是如果您坚持要有多个表和表单,那么在提交之前,您可以验证第一个表单。如果我没有错的话,您正在尝试更好的UI布局,可以处理CSS而不是多个表单和表格。请确保您已在第一个表单中提交。 你有多种形式。因此,所需的功能不起作用
<html>
<head>
<link href="icon.ico" rel="icon">
<title>Log In</title>
</head>
<body>
<h1 align="center">Welcome to site</h1>
<hr width="50%" />
<br/>
<table align="center">
<form id="form1" runat="server">
<tr>
<td>Log In : </td>
<td>
<input type="text" name="LogInEmail" placeholder="Enter your email" required>
</td>
</tr>
<tr>
<td>Password : </td>
<td>
<input type="password" name="password" placeholder="Password" required>
</td>
</tr>
<tr>
<td>
<input type="submit" value=" Log In " />
</td>
</tr>
</form>
</table>
</body>
</html>
登录
欢迎来到我们的网站
登录:
密码:
但是如果您坚持要有多个表和表单,那么在提交之前,您可以验证第一个表单。如果我没有错,您正在尝试使用更好的UI布局,可以处理CSS而不是多个表单和表格。您使用了两个表单。您应该将提交按钮放置在相同的表单输入要求字段中。请小心表单。您使用了两个表单。您应该将提交按钮放置在相同的表单输入要求字段中。请小心关于表单。我有一个问题,我刚刚替换了表单中的提交按钮。它对我有效:)我有一个问题,我刚刚替换了表单中的提交按钮。它对我有效:)您好,请提供您的期望和实际结果,以便社区能够帮助您解决“错误”(你没有描述)。我只是想说,如果任何一个字段没有填写,那么我想留言“请填写此字段”@gildasbound@Hello的可能副本,请提供你的期望和实际结果,以便社区可以帮助你解决“错误”(你没有描述)。我只想知道,如果有任何字段没有填写,我想发送一条消息“请填写此字段”@gildasp可能的副本