Html 为什么单选按钮不能正常工作??
这是我代码中显示单选按钮的简短部分Html 为什么单选按钮不能正常工作??,html,Html,这是我代码中显示单选按钮的简短部分 <table width="100%"> <tr> <td style="text-align:center"> <input type="radio" name="ah" value="" id="ah" align="left" checked="checked" />AH </td> <td style="text-align:center"&g
<table width="100%">
<tr>
<td style="text-align:center">
<input type="radio" name="ah" value="" id="ah" align="left" checked="checked" />AH
</td>
<td style="text-align:center">
<input type="radio" name="esp" value="none" id="esp" align="right"/>ESP
</td>
</tr>
</table>
问题是,一个单选按钮AH在这里提到的默认情况下是选中的,当我点击其他单选按钮时,它也会被选中
但是现在两个都被检查了,我如何禁用它们。
我认为当我点击一个单选按钮时,它会自动发生,另一个按钮会自动禁用。
请纠正我哪里错了???您需要为两个单选按钮赋予相同的名称属性,以便浏览器能够识别它们属于同一组。要将单选按钮组合在一起,它们应该共享相同的名称:
它们需要具有相同的name属性 试试这个,它会有帮助的。。。。您必须为两个单选按钮指定相同的名称
<table width="100%">
<tr>
<td style="text-align:center">
<input type="radio" name="esp" value="" id="ah" align="left" checked="checked" />AH
</td>
<td style="text-align:center">
<input type="radio" name="esp" value="none" id="esp" align="right"/>ESP
</td>
</tr>
</table>
感谢它工作正常…你能告诉我是否可以在堆栈溢出上显示html输出吗???@Udit不客气。不确定你所说的HTML输出到底是什么意思?你是说呈现的HTML?不,这是不可能的:您必须使用类似的服务
<table width="100%">
<tr>
<td style="text-align:center">
<input type="radio" name="esp" value="" id="ah" align="left" checked="checked" />AH
</td>
<td style="text-align:center">
<input type="radio" name="esp" value="none" id="esp" align="right"/>ESP
</td>
</tr>
</table>