Js检测单选框是否选中

/**
* 修改监管频度
*/
function modSF() {
         var radios = document.getElementsByName( "sfId");
         var id = "";
         var flag = 0;
         for ( var k = 0; k < radios.length; k++) {
                 if (radios[k].checked) {
                        id = radios[k].value;
                        flag = 1;
                         var retValue = window.showModalDialog(rootPath + "/addSFOrUpdateUI.do?sfId=" + id, "", 'resizable:no;status:no;scroll:no;dialogWidth:' + 600 + 'px;DialogHeight=' + 250 + 'px');
                         if (retValue != "undefined") {
                                doSearch();
                        }
                }
        }
         if (!flag) { //不在for循环内
                alert( "请选中要修改的内容");
                 return false;
        }
}

本文出自 “每天进步一点点” 博客,转载请与作者联系!

你可能感兴趣的:(JavaScript,js,职场,选中,休闲,是否,单选框)