<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> special effects asp.net tutorials to determine whether a radio button is selected several methods </title>
<script language= "Web Effects" >
function Yanzheng () {
var thecheckboxinputs=document.getelementsbyname (' Gender ');
for (Var i=0;i<thecheckboxinputs.length;i++)
{
if (thecheckboxinputs[i].checked)
return true;
}
Alert (' You have not selected one of these items ');
return false;
}
</script>
<body>
<form id= "Form1" Name= "Form1" method= "Post" action= "" >
<label>
<input type= "Radio" name= "Gender" id= "Radio" value= "Radio"/> Male
</label>
<label>
<input type= "Radio" name= "Gender" id= "Radio2" value= "Radio2"/> Female
</label>
<label>
<input type= "Submit" name= "submit" value= "Submit" onclick= "return Yanzheng ();" />
</label>
</form>
</body>
asp.net
this.radiobuttonlist.items[0].selected==true;
//
<script>
function Check ()
{
for (I=0;i <document.form1.r1.length;i++)
if (document.form1.r1[i].checked)
{alert (document.form1.r1[i].value); return;}
}
</script>
<form name=form1>
<input Type=radio name=r1 value=1>
<input Type=radio name=r1 value=2>
<input Type=radio name=r1 value=3>
<input Type=button Onclick=check () >
</form>