<form name="frm">
<input type="radio" value="1" name="radioname">
<input type="radio" value="2" name="radioname">
<input type="button" onclick="alert(checkradio(this.form.radioname));">
</form>
<script language="javascript">
<!--
//求单选按纽的值,适用单选项及多选项。未选返回false;有选择项,返回选项值。
function checkradio(theradio){
var theradiolen = theradio.length;
var theradiovalue = false;
if (theradiolen == undefined){
if (theradio.checked){
theradiovalue = theradio.value;
}
}else{
for (theradioi=0;theradioi<theradiolen;theradioi++){
if (theradio[theradioi].checked){
theradiovalue = theradio[theradioi].value;
break;
}
}
}
return theradiovalue;
}
//-->
</script>
| 对此文章发表了评论 |
