JS代码:

<script language="javascript" type="text/javascript">
        function RadioButtonList1Changed() {
            var vRbtid = document.getElementById("RadioButtonList1");
            //得到所有radio
            var vRbtidList = vRbtid.getElementsByTagName("INPUT");
            for (var i = 0; i < vRbtidList.length; i++) {
                if (vRbtidList[i].checked) {
                    var text = vRbtid.cells[i].innerText;
                    var value = vRbtidList[i].value;
                    alert("选中项的text值为" + text + ",value值为" + value);
                }
            }
            }
    </script>

HTML:

 <asp:RadioButtonList ID="RadioButtonList1" runat="server" onClick="return RadioButtonList1Changed()">
             <asp:ListItem>1</asp:ListItem>
             <asp:ListItem>2</asp:ListItem>
             <asp:ListItem>3</asp:ListItem>
         </asp:RadioButtonList>

相关文章:

  • 2021-10-26
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2021-11-17
  • 2021-10-21
相关资源
相似解决方案