<SCRIPT LANGUAGE="JavaScript">
function check()
{
if(checkspace(document.form1.user.value)) {
document.userinfo.username.focus();
alert("对不起,请填写用户名!");
return false;
}
if(checkspace(document.fom1.pwd.value) || document.from.pwd.value.length < 6 || document.form1.pwd.value.length >20) {
document.form1.pwd.focus();
alert("密码长度不能不能这空,在6位到20位之间,请重新输入!");
return false;
}
if(document.form1.pwd.value != document.form1.pwd1.value) {
document.form1.pwd.focus();
document.form1.pwd.value = '';
document.form1.pwd1.value = '';
alert("两次输入的密码不同,请重新输入!");
return false;
}
if(document.form1.useremail.value.length!=0)
{
if (document.userinfo.useremail.value.charAt(0)=="." ||
document.userinfo.useremail.value.charAt(0)=="@"||
document.userinfo.useremail.value.indexOf('@', 0) == -1 ||
document.userinfo.useremail.value.indexOf('.', 0) == -1 ||
document.userinfo.useremail.value.lastIndexOf("@")==document.userinfo.useremail.value.length-1 ||
document.userinfo.useremail.value.lastIndexOf(".")==document.userinfo.useremail.value.length-1)
{
alert("Email地址格式不正确!");
document.userinfo.useremail.focus();
return false;
}
}
else
{
alert("Email不能为空!");
document.userinfo.useremail.focus();
return false;
}
if(checkspace(document.userinfo.tel.value)) {
document.userinfo.tel.focus();
alert("对不起,请填写联系电话!");
return false;
}
if(checkspace(document.userinfo.address.value)) {
document.userinfo.address.focus();
alert("对不起,请填写联系地址!");
return false;
}
if(checkspace(document.userinfo.postcode.value)) {
document.userinfo.postcode.focus();
alert("对不起,请填写邮政编码!");
return false;
}
if(checkspace(document.userinfo.yz.value)) {
document.userinfo.yz.focus();
alert("对不起,请填写验证码!");
return false;
}
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
</script>