js 表单验证

function one() {
var group = document.getElementById("group").value;
if(group == ""){alert("分组不能为空"); return false;}
var ss = document.getElementById("ss").value;
if(ss == ""){alert("城市不能为空"); return false;}
var sss = document.getElementById("sss").value;
if(sss == ""){alert("县区不能为空"); return false;}

}


function two(){
var name = document.getElementById("name").value;
if(name == ""){alert("名字不能为空"); return false;}
var psw = document.getElementById("psw").value;
if(psw == ""){alert("密码不能为空"); return false;}
var number = document.getElementById("number").value;
if(number == ""){alert("手机号不能为空"); return false;}
var groups = document.getElementById("groups").value;
if(groups == ""){alert("分组不能为空"); return false;}
var gss = document.getElementById("gss").value;
if(gss == ""){alert("城市不能为空"); return false;}
var gsss = document.getElementById("gsss").value;
if(gsss == ""){alert("县区不能为空"); return false;}

}


function three(){
var upname = document.getElementById("upname").value;
if(upname == ""){alert("名字不能为空"); return false;}
var uppsw = document.getElementById("uppsw").value;
if(uppsw == ""){alert("密码不能为空"); return false;}
var upnumber = document.getElementById("upnumber").value;
if(upnumber == ""){alert("手机号不能为空"); return false;}
var upgroup = document.getElementById("upgroup").value;
if(upgroup == ""){alert("分组不能为空"); return false;}
var upss = document.getElementById("upss").value;
if(upss == ""){alert("城市不能为空"); return false;}
var upsss = document.getElementById("upsss").value;
if(upsss == ""){alert("县区不能为空"); return false;}
}

 

 

<form action="pup.php" method="post" onsubmit="return three()">

 

以此类推

posted @ 2014-12-24 15:58  fleam  阅读(178)  评论(0编辑  收藏  举报