Search from the Internet a lot of information, toss a half-day, finally fix, write down for everyone to reference
This was found on the Internet.
<script language= "JavaScript" >
function GetValue () {
var B = document.all.rbtid.length
var a = document.getElementById ("Rbtid"). Rows.length;
alert (b); result is 5
alert (a); result is 4
for (Var i=0;i<b-1;i++) This is OK
for (var i = 0; i < A; i++) {
var ss = "Rbtid_" + i;
var AA = document.getElementById (ss). Value;
if (eval (' Document.all.rbtid_ ' +i). Checked==true)//This can also be done by the Eval () function to turn the data character string into JS run
var bb = document.getElementById (ss);
if (document.getElementById (ss). Checked)//note checked can not be written checked, otherwise unsuccessful
{
alert (AA);
Break
}
}
}
</script>
RadioButtonList put it in the form and run.
But in the Ajax control Tabcontainer, the method fails.
So look at the source of the Web page, found the problem, modify it to be
function GetValue () {
var B = document.all.rbtid.length
var a = document.getElementById ("Rbtid"). Rows.length;
alert (b); result is 5
alert (a); result is 4
for (Var i=0;i<b-1;i++) This is OK
for (var i = 0; i < A; i++) {
var ss =document.getelementbyid ("<%=rbtid. Clientid%> "). Id+" _ "+i;
if (eval (' Document.all.rbtid_ ' +i). Checked==true)//This can also be done by the Eval () function to turn the data character string into JS run
var bb = document.getElementById (ss);
if (document.getElementById (ss). Checked)
var AA = document.getElementById (ss). Value;
if (eval (' Document.all.rbtid_ ' +i). Checked==true)//This can also be done by the Eval () function to turn the data character string into JS run
var bb = document.getElementById (ss);
if (document.getElementById (ss). Checked)//note checked can not be written checked, otherwise unsuccessful
{
alert (AA);
Break
}
}
}
Talk about JavaScript. Gets the value of the server control