The
looks like this:
<%@ Page language= "C #" codebehind= "WebForm1.aspx.cs" autoeventwireup= "false" inherits= "Ajaxselect. Onmousetitle.webform1 "%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > <HTML> <HEAD> <title>WebForm1< /title> <meta content= "Microsoft Visual Studio. NET 7.1" name= "generator" > <meta content= "C #" Name= "CO De_language "> <meta content=" JavaScript "name=" vs_defaultClientScript "> <meta content=" Http://schemas. Microsoft.com/intellisense/ie5 "Name=" vs_targetschema > <script language= "javascript" > function Getvalu
E () {var b=document.all.rbtid.length var A=document.getelementbyid ("Rbtid"). Cells.length; alert (b); The result is 5//alert (a); The result is 4//for (var i=0;i<b-1;i++) It is also OK for (Var i=0;i<a;i++) {var ss= "RBT"
Id_ "+I;
var Aa=document.getelementbyid (ss). Value; if (eval (' Document.all.rbtid_ ' +i). Checked==true)//This is OK. The eval () function can turn a string of data characters into JS to run Var Bb=document.getelementbyid (ss);
if (document.getElementById (ss). Checked)//note checked cannot be written checked, otherwise it will not succeed {alert (AA);
Break
}
}
}
Or in the second way:
Get RadioButtonList
var Vrbtid=document.getelementbyid ("Rbtid");
Get all 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 (The text value of the selected item is "+text+" and the value is "+value");
}
In this method, RadioButtonList is treated as a table at the client, obtains all its child radio through the getElementsByTagName ("INPUT") method, and then loops each radio, The text value of the radio is then obtained by cells.
</script>
</HEAD>
<body ms_positioning= "GridLayout" >
<form id= "Form1" method= " Post "runat=" server >
<font face= "song body" >
<asp:radiobuttonlist id= "Rbtid" style= "z-index:101"; left:8px; Position:absolute; top:8px "runat=" Server "
width=" 216px "height=" 176px "name=" Rbtid ">
<asp:listitem value=" 0 ">0</ asp:listitem>
<asp:listitem value= "1" selected>1</asp:listitem>
<asp:listitem Value= "2" >2</asp:ListItem>
<asp:listitem value= "3" >3</asp:ListItem>
</asp: Radiobuttonlist><input style= "z-index:102; left:184px; Position:absolute; Top:256px "onclick=" GetValue () "
type=" button "value=" button "></FONT>
</form>
</ Body>
</HTML>
The above JS get RadioButtonList selected value of the two methods (recommended) is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud habitat community.