<script type="text/javascript">
function js(id){
return document.getElementById(id);
}
function checkInput(){
js("msg").innerHTML ="";
var loginName = js("loginName").value;
var loginPwd = js("loginPwd").value;
var valiCode = js("valiCode").value;
if(loginName.length==0){
js("msg").innerHTML ="用戶名不能為空!";
}else if(loginName.length<5){
js("msg").innerHTML ="用戶名長度為6-20字符!";
}else if(loginPwd.length==0){
js("msg").innerHTML =" 密碼不能為空!";
}else if(loginPwd.length<5){
js("msg").innerHTML ="密碼長度為6-20字符!";
}else if(valiCode.length!=4){
js("msg").innerHTML ="驗證碼長度為4位!";
}else if(isNaN(valiCode)){
js("msg").innerHTML ="請輸入數字驗證碼!";
}else{
js("msg").innerHTML ="";
js("loginForm").submit();
}
}
//alert(loginName+":" + loginPwd+":"+ valiCode);
</script>
costom validate function
最新推荐文章于 2024-04-30 08:58:14 发布