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;
}

 

posted @ 2019-12-03 17:40  HelloWorld102  阅读(1725)  评论(0编辑  收藏  举报