JS获取单选与多选按纽的值
//求单选按纽的值,适用单选项及多选项。未选返回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;
}
theRadio这个取值:表单名.元素名称
浙公网安备 33010602011771号