获取radio的值
JS:
var obj = document.getElementsByName("sex");
function GetRadioValue(RadioName){
var obj = RadioName;
//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;
}
HTML:
<input type="radio" id="sex" name="sex" value="男"/>
<input type="radio" id="sex" name="sex" value="女"/>