LABEL 在 IE11 中无法使用 <TR>,需要 select 在任意位置单击该行的单选按钮

LABEL is not working in IE11 with <TR>, need to select the radio button on click of the row anywhere

在 table 中使用下面的一段代码,它会在单击该行时选择收音机。它适用于 IE9,但这段代码不适用于 IE10 及更高版本或 chrome。任何人都可以建议他们是否遇到过类似的问题? 任何涉及少量修改的建议都会有所帮助。

<LABEL FOR="radio<%=k%>" align="top">
<TR BGCOLOR="#<%=rowColor%>">
    <TD WIDTH="25" VALIGN="top"><INPUT TYPE="RADIO" NAME="xyz"
        <%=checked%> ID="radio<%=k%>" VALUE="<%=value%>"></TD>
    <TD WIDTH="120" VALIGN="top"><%=value%></TD>
    <TD WIDTH="145" VALIGN="top"><%=value%>
    <%=value%></TD>
    <TD WIDTH="135" VALIGN="top"><%=value%>
    <%=value%></TD>
    <TD WIDTH="50" VALIGN="top"><%=value%></TD>
    <TD WIDTH="*" VALIGN="top"><%=value%>
    </TD>
</TR>
</LABEL>

您不能在单独的 label 中包含单独的 tr。尝试一些脚本来实现这一点。

function toggle_row(e, row_id) {
  e = e || window.event; //get event
  var el = e.srcElement || e.target; //get the right html element, on which user clicked
  var input = document.getElementById(row_id);//get the checkbox for the row clicked
  if (el != input) //checkbox was not clicked
    input.checked = !input.checked; //flip the checkbox selection
}
tr {
  cursor: pointer;
}
<table>
  <tr onclick="toggle_row(event,'row_1')">
    <td>
      <input type="checkbox" id="row_1" />
    </td>
    <td>Foo</td>
    <td>Bar</td>
  </tr>
  <tr onclick="toggle_row(event,'row_2')">
    <td>
      <input type="checkbox" id="row_2" />
    </td>
    <td>Foo</td>
    <td>Bar</td>
  </tr>
  <tr onclick="toggle_row(event,'row_3')">
    <td>
      <input type="checkbox" id="row_3" />
    </td>
    <td>Foo</td>
    <td>Bar</td>
  </tr>
</table>