<script language="JavaScript">
function checkform()
{
if(checkspace(document.form1.username.value) || document.form1.username.value.length < 2) {
document.form1.username.focus();
alert("用户名长度不能小于2,请重新输入!");
return false;
}
if(checkspace(document.form1.pwd.value) || document.form1.pwd.value.length < 6) {
document.form1.pwd.focus();
alert("密码长度不能小于6,请重新输入!");
return false;
}
if(document.form1.pwd.value != document.form1.pwd1.value) {
document.form1.password.focus();
document.form1.password.value = '';
document.form1.password1.value = '';
alert("两次输入的密码不同,请重新输入!");
return false;
}
if(document.form1.useremail.value.length!=0)
{
if (document.form1.useremail.value.charAt(0)=="." ||
document.form1.useremail.value.charAt(0)=="@"||
document.form1.useremail.value.indexOf(
'@', 0) == -1 ||
document.form1.useremail.value.indexOf('.', 0) == -1 ||
document.form1.useremail.value.lastIndexOf("@")==document.form1.useremail.value.length-1 ||
document.form1.useremail.value.lastIndexOf(".")==document.form1.useremail.value.length-1)
{
alert("Email地址格式不正确!");
document.form1.useremail.focus();
return false;
}
}
else
{
alert("Email不能为空!");
document.form1.useremail.focus();
return false;
}
document.all.form1.submit();
}
</script>
谢谢指教