添加Fieldset后,复选框消失了

时间:2011-10-31 19:01:06

标签: html xhtml

我正在使用此代码,当我将字段集添加到我的复选框时,它就消失了。在我添加字段集之前,复选框与单选按钮一起显示正常。提前谢谢!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<LINK REL=StyleSheet HREF="davidwalker.css" TYPE="text/css">
<head><title>Contact Us!</title></head>
<form>
Name:  <input type="text" name="custname" /><br />
Email:  <input type="text" name="email" /><br />
Questions/Comments/Concerns:  <textarea name="comments" rows="10" cols="30"></textarea><br />
Please select your category:    <select name="category">
                                <option value="appdev">Application Development</option>
                                <option value="hardware">Hardware Question</option>
                                <option value="general">General Question</option>
                                </select><br />
<FIELDSET>
    <LEGEND ACCESSKEY=O>Please select your OS:</LEGEND>
    <LABEL ACCESSKEY=1><input type="radio" name="OS" value="WinXP" />Windows XP</LABEL><br />
    <LABEL ACCESSKEY=2><input type="radio" name="OS" value="Mac" />Mac</LABEL><br />
    <LABEL ACCESSKEY=3><input type="radio" name="OS" value="Linux" />Linux</LABEL><br />
    <LABEL ACCESSKEY=4><input type="radio" name="OS" value="Free" />FreeBSD</LABEL><br />
    <LABEL ACCESSKEY=5><input type="radio" name="OS" value="other" />Other</LABEL><br />
</FIELDSET>
<FIELDSET>
    <LEGEND ACCESSKEY=D>Please select your devices:</LEGEND>  
    <LABEL ACCESSKEY=6<input type="checkbox" name="device" value="PC" />PC</LABEL><br />
    <LABEL ACCESSKEY=7<input type="checkbox" name="device" value="Mac" />Mac</LABEL><br />
    <LABEL ACCESSKEY=8<input type="checkbox" name="device" value="Tablet">Tablet</LABEL><br />
    <LABEL ACCESSKEY=9<input type="checkbox" name="device" value="SmartPhone">SmartPhone</LABEL><br />
</FIELDSET>


<html>

2 个答案:

答案 0 :(得分:3)

您没有关闭第二个字段集中的开始标记...

<LABEL ACCESSKEY=6<input type="checkbox" name="device" value="PC" />

注意:缺少“&gt;”在ACCESSKEY = 6之后

 <LABEL ACCESSKEY=6><input type="checkbox" name="device" value="PC" />

我认为这应该可以解决你的问题: - )

答案 1 :(得分:1)

我注意到在第二个字段集中,对于Tablet和SmartPhone,输入元素后面没有结束/。请看看是否有帮助。

即。改变:

<LABEL ACCESSKEY=8<input type="checkbox" name="device" value="Tablet">Tablet</LABEL><br />
<LABEL ACCESSKEY=9<input type="checkbox" name="device" value="SmartPhone">SmartPhone</LABEL><br />

<LABEL ACCESSKEY=8<input type="checkbox" name="device" value="Tablet"/>Tablet</LABEL><br />
<LABEL ACCESSKEY=9<input type="checkbox" name="device" value="SmartPhone"/>SmartPhone</LABEL><br />