js获取radiobuttonlist value 和 text 值

  function check() {
            var ckl = document.getElementById("RadioButtonList1");
            var ck = ckl.getElementsByTagName("input");
            for (var i = 0; i < ck.length; i++) {
                if (ck[i].checked) {
                    var text = ckl.cells[i].innerText;
                    var value = ck[i].value;

                }

            }
        }
 <div>
   
    <asp:RadioButtonList ID="RadioButtonList1" runat="server">
    <asp:ListItem Value="我是value1">我是text1</asp:ListItem>
    <asp:ListItem Value="我是value2">我是text2</asp:ListItem>
    <asp:ListItem Value="我是value3">我是text3</asp:ListItem>
    </asp:RadioButtonList>
     <asp:Button ID="Button2" runat="server" Text="js获取选中值" OnClientClick="check()" />
      </div>

 

posted on 2013-05-17 10:37  小东北  阅读(347)  评论(0编辑  收藏  举报