用 <form>
包裹表单的每个元素是否错误? HTML 页面中的标签?很好奇为什么会出错:
基本上我必须介绍两种形式(form1
和 form2
),有些元素与第一种相关,而另一些与第二种相关。布局必须完全基于表格,因为两种形式的元素都是整页都是我写的(根据 http://validator.w3.org/check,代码有效):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<table border="1">
<tr>
<td>
<form name="form1" method="POST" action="via.php">
Enter the first form text here!: <input type="text" name="first"/>
</form>
</td>
<td rowspan="2">
<form name="form2" method="POST" action="via.php">
Enter the second form text here!:<input type="text" name="second"/>
</form>
<form name="form1" method="POST" action="via.php">
Enter the first form text here!:<input type="text" name="first"/>
</form>
</td>
</tr>
<tr>
<td>
<form name="form1" method="POST" action="via.php">
<input type="submit" name="form1submit" value="submit1"/>
</form>
<form name="form12" method="POST" action="via.php">
<input type="submit" name="form2submit" value="submit2"/>
</form>
</td>
</tr>
</table>
最佳答案
根据the specification,不允许嵌套形式:
在 w3 validator 中给出这个输入:
<!DOCTYPE html><html><head><title>tit</title></head><body>
<form action="x">
<form action="x">
<input type="submit" value="x"> <!-- Submitting.. Which form...?-->
</form>
</form>
</body></html>
w3 验证器说:
关于html - 是否可以将 html 表单元素包装在多个表单标签中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9433264/