Copy Code code as follows:
<! 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>JS get radio button value instance </title>
<body>
<form id= "Form1" Name= "Form1" method= "Post" action= "" >
<p>
<label>
<input type= "Radio" name= "RadioGroup1" value= "Radio" id= "Radiogroup1_0"/>
Radio </label>
<br/>
<label>
<input type= "Radio" name= "RadioGroup1" value= "Radio" id= "Radiogroup1_1"/>
Radio </label>
<br/>
<label>
<input name= "RadioGroup1" type= "Radio" id= "Radiogroup1_2" value= "Radio"/>
Radio </label>
<br/>
<label>
<input type= "Radio" name= "RadioGroup1" value= "Radio" id= "Radiogroup1_3"/>
Radio </label>
<input type= "Submit" name= "button" id= "button" value= "Submit" onclick= "Javascript:return checksubmit ()"/>
<br/>
</p>
</form>
<script>
function Checksubmit ()
{
if (Getradiovalue (' RadioGroup1 '))
{
Alert (' selective ');
}
Else
{
Alert (' no choice ');
}
}
function Getradiovalue (radioname) {
var obj;
Obj=document.getelementsbyname (Radioname);
if (obj!=null) {
var i;
for (i=0;i<obj.length;i++) {
if (obj[i].checked) {
return obj[i].value;
}
}
}
return null;
}
</script>
</body>