限制复选框的选择

Sac*_*dra 0 javascript

如何让用户只检查其中一个复选框..除了禁用选择复选框之外还有什么方法吗?

<td width="25%"><input type="checkbox" name="choice" value="Good" />Good</td>
<td width="25%"><input type="checkbox" name="choice" value="Average" />Average</td>
<td width="25%"><input type="checkbox" name="choice" value="Sucks" />Sucks</td>
<td width="25%"><input type="checkbox" name="choice" value="Fascinating" />Fascinating</td>
Run Code Online (Sandbox Code Playgroud)

如果它是一个JavaScript,请让它简单易懂..

Pek*_*ica 5

您正在寻找一个单选按钮组.

<td width="25%"><input type="radio" name="choice" value="Good" />Good</td>
<td width="25%"><input type="radio" name="choice" value="Average" />Average</td>
<td width="25%"><input type="radio" name="choice" value="Sucks" />Sucks</td>
<td width="25%"><input type="radio" name="choice" value="Fascinating" />Fascinating</td>
Run Code Online (Sandbox Code Playgroud)