下面的代码,看起来比较长,其实只要看其中的(input type = "radio")部分就可以了,贴出全部,以便调试
<html>
<head>
<link rel = "stylesheet" type = "text/css" href = "form.css" />
</head>
<body>
<h1>Include a Note Card </h1>
<form method = "post" action = "test.php">
<p>
<input type = "checkbox" id = "gift" />
<label for = "gift">Check this box if your order is a gift</label>
</p>
<label for = "Name" >Sender's Name :</label>
<input type = "text" id = "Name" value = "Your name" />
<fieldset>
<legend>Color of Paper :</legend>
<label><input type = "radio" value = "blue" name = "blue">Blue</label>
<label><input type = "radio" value = "Pink" name = "Pink">Pink</label>
<label><input type = "radio" value = "White" name = "White" checked = "checked">White</label>
</fieldset>
<label for = "InkColor">Ink Color :</label>
<select id = "InkColor ">
<option selected value = "black">Black</option>
<option selected value = "navy">Navy Blue</option>
<option selected value = "maroon">Maroon</option>
<option selected value = "green">Green</option>
<option selected value = "gray">Gray</option>
<option selected value = "red">Red</option>
</select>
<br />
<label for = "CardMessage">Card Message :</label>
<textarea id = "CardMessage" rows= "4" cols = "40">Type Your Message Here</textarea>
<br />
<label for = "ChooseAFont">Choose a Font :</label>
<select id = "ChooseAFont" size = "4">
<option selected value = "Times">Times New Roman</option>
<option value = "Optima">Optima</option>
<option value = "Verdana">Verdana</option>
<option value = "Papyrus">Papyrus</option>
<option value = "MarkerFelt">Marker Felt</option>
<option value = "Arial">Arial</option>
<option value = "CourierNew">Courier New</option>
</select>
<br /> <button type = "button" value = "back">Go Back</button>
<button type = "submit" value = "submit">Submit</button>
<button type = "reset" value = "reset">Reset</button>
</form>
</body>
</html>
运行了一下,发现其中的单选(input type = "radio")能选好几个,非常纳闷,怎么才能做到只选一个?谢谢!