|
function checkXb(){
var temp = false;
var xbObj1= document.getElementById("xb1");
var xbObj2= document.getElementById("xb2");
if(xbObj1.checked || xbObj2.checked){
temp = true;
}
return temp;
}
function checkform() {
//驗(yàn)證性別(單選按鈕驗(yàn)證)
if(!checkXb()){
alert("請(qǐng)選擇性別");
return false;
}
//驗(yàn)證人員類別(下拉框驗(yàn)證)
if(document.getElementById("lb").selectedIndex == 0){
alert("請(qǐng)選擇人員類別");
return false;
}
}
// (復(fù)選框驗(yàn)證)判斷是否選擇了至少一個(gè)CheckBox.
function checkSelectedOne(cbxName){
var cbxs = document.getElementsByName(cbxName);
if(cbxs != null){
if(cbxs.length){
for(var i=0; i<cbxs.length; i++){
if(cbxs[i].checked) {
return true;
}
}
}else{
return cbxs.checked
}
}
return false;
}
if(!checkSelectedOne('xgjzh')){
alert("你沒有選擇!");
}
jsp技術(shù):JSP單選按鈕驗(yàn)證、下拉框驗(yàn)證、復(fù)選框驗(yàn)證實(shí)現(xiàn)代碼,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。