【问题标题】:php radio group strange behaviorphp广播组奇怪的行为
【发布时间】:2012-02-18 17:00:10
【问题描述】:

我在多项选择测验表单中有一组单选按钮,但我在使用这些按钮时遇到了一些问题。 当我尝试单击除第一个单选按钮之外的任何其他单选按钮时,它会立即将第一个单选按钮显示为选中状态,并且需要 3-4 次尝试才能最终标记所需的按钮。如果你想测试,这是我的代码:

               <form action="<?php echo $editFormAction; ?>" method="post" name="form" target="_self" id="form1">
          <table width="100%" border="0" cellpadding="2" cellspacing="0">
                <tr>
                  <td class="greentitle">Question 1</td>
                  <td>
                  <label>
                    <input type="radio" name="environment" value="1" />1
                    <input type="radio" name="environment" value="2" />2
                    <input type="radio" name="environment" value="3" />3
                    <input type="radio" name="environment" value="4" />4
                    <input type="radio" name="environment" value="5" />5
                  </label>
                  </td>
                </tr>
                <tr>
                  <td class="greentitle">Question 2</td>
                  <td>
                  <input name="speed" type="radio" value="1" />1
                  <input name="speed" type="radio" value="2" />2
                  <input name="speed" type="radio" value="3" />3
                  <input name="speed" type="radio" value="4" />4
                  <input name="speed" type="radio" value="5" />5
                  </td>
                </tr>
                <tr>
                  <td class="greentitle">Question 3</td>
                  <td>
                  <input name="quality" type="radio" value="1" />1
                  <input name="quality" type="radio" value="2" />2
                  <input name="quality" type="radio" value="3" />3
                  <input name="quality" type="radio" value="4" />4
                  <input name="quality" type="radio" value="5" />5 
                  </td>
                </tr>
                <tr>
                  <td class="darkgrey">&nbsp;</td>
                  <td><input name="submit" type="submit" class="formmed" id="submit" value="Submit" tabindex="5"  style="width:200px;"/></td>
                </tr>
              </table>
        </form>

【问题讨论】:

  • 对我来说很好:jsfiddle.net/uQEfF
  • 可能是因为第一组单选按钮在

标签: php html radio-button radio-group


【解决方案1】:

我已经查看了您的代码。 从第一个 radio(name="environment") 组中删除 label 标记。然后就可以正常工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-16
    • 2012-06-05
    • 1970-01-01
    • 2018-06-29
    • 2013-07-23
    • 1970-01-01
    • 2014-07-08
    • 2013-08-09
    相关资源
    最近更新 更多