更新时间:2022-03-10 07:14:52
var rbtNew = document.getElementById('rbtNew');
var rbtOld = document.getElementById('rbtOld');
if (rbtNew != null && rbtOld != null) {
if (rbtNew.checked == false && rbtOld.checked == false) {
alert("our Alert Message ");
return false;
}
}
在上面的代码中,rbtNew!= null表示页面源中存在单选按钮,否则它将具有空值。
In the above code rbtNew != null means radio button is exist in page source otherwise it will have null value.