字段集验证。字段集位于表单内部,并在外部有输入
<form id="youtube-form" method="post" action="">
<label for="searchField" id="label-youtube-id">YouTube ID:</label>
<input type="text" id="searchField" name="videoid" class="search-field" />
<fieldset id="outputFieldset">
<legend>Output format:</legend>
<label for="flv">FLV</label>
<input type="radio" id="flv" name="format" class="radio-button" value="flv" />
<label for="avi">AVI</label>
<input type="radio" id="avi" name="format" class="radio-button" value="avi" />
<label for="mp3">MP3</label>
<input type="radio" id="mp3" name="format" class="radio-button" value="mp3" />
</fieldset>
<input id="youtube-submit" type="submit" name="submit" value="Submit" />
</form>
这段代码有什么问题?我验证时似乎遇到错误。 (也是三个)
第 21 行,第 49 列:文档类型 此处不允许使用元素“label”; 缺少“ins”、“del”、“h1”之一, “h2”、“h3”、“h4”、“h5”、“h6”、“p”、 “div”、“地址”、“fieldset”开始标记
是因为我需要添加更多字段集,还是我做错了什么?
非常感谢任何帮助:)
<form id="youtube-form" method="post" action="">
<label for="searchField" id="label-youtube-id">YouTube ID:</label>
<input type="text" id="searchField" name="videoid" class="search-field" />
<fieldset id="outputFieldset">
<legend>Output format:</legend>
<label for="flv">FLV</label>
<input type="radio" id="flv" name="format" class="radio-button" value="flv" />
<label for="avi">AVI</label>
<input type="radio" id="avi" name="format" class="radio-button" value="avi" />
<label for="mp3">MP3</label>
<input type="radio" id="mp3" name="format" class="radio-button" value="mp3" />
</fieldset>
<input id="youtube-submit" type="submit" name="submit" value="Submit" />
</form>
What is wrong with this code? I seem to get an error when I validate. (three of them too)
Line 21, Column 49: document type does
not allow element "label" here;
missing one of "ins", "del", "h1",
"h2", "h3", "h4", "h5", "h6", "p",
"div", "address", "fieldset" start-tag
Is it because I need to add more fieldsets, or is it something else I have done wrong?
Any help is much appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不允许
input
和label
元素作为form
元素的子元素。ins
、del
、h1
、h2
、h3
、h4< /code>,
允许作为子元素,也允许将h5
,h6
,p
,div
,地址
, < code>fieldsetinput
和label
元素作为其子元素(尽管大多数在语义上并不合适)。input
andlabel
elements are not allowed as child elements toform
elements.ins
,del
,h1
,h2
,h3
,h4
,h5
,h6
,p
,div
,address
,fieldset
are allowed as child elements and are also allowed to haveinput
andlabel
elements as their children (although most are not semantically appropriate).标签和输入应该位于字段集中。或者创建第二个/第三个字段集以将它们分开。
例如:
Labels and inputs should be inside the fieldset. Or create a second/third filedset to enclose them separately.
eg: