Skip to content

Instantly share code, notes, and snippets.

@bestony
Created October 21, 2016 13:39
Show Gist options
  • Save bestony/8c6a28e7e3e84bd2e9da79cd128ae295 to your computer and use it in GitHub Desktop.
Save bestony/8c6a28e7e3e84bd2e9da79cd128ae295 to your computer and use it in GitHub Desktop.
获取Radio的值
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment