js判断radio选中状态
var radios = document.getElementsByName("radiosName"); var checked = false; for ( var j = 0; j < radios.length; j++) { if (radios[j].checked==true) { checked = true; } } if(!checked) { alert("未选择!"); return false; }
var radios = document.getElementsByName("radiosName"); var checked = false; for ( var j = 0; j < radios.length; j++) { if (radios[j].checked==true) { checked = true; } } if(!checked) { alert("未选择!"); return false; }