<script language=javascript>
function checkform(){
var reg=/[a-z|A-Z|0-9]/gi;
if (document.form1.username.value=="" || document.form1.username.value.length<4 || document.form1.username.value.length>10)
{
alert("请输入用户名,不能少于4个字符或者大于10个字符");
document.form1.username.focus();
return false;
}
if(document.form1.pwd.value != document.form1.pwd1.value)
{
alert("两次输入不同");
document.form1.pwd.focus();
return false;
}
if (reg.test(document.form1.pwd.value)==false || reg.test(document.form1.pwd1.value)==false)
{
alert("密码必须位0-9,a-z,A-Z组成");
document.form1.pwd.focus();
return false;
}
return true;
}
</script>
<form name=form1 onsubmit="return checkform()" action="aa.asp" method="post">
<input type="text" name="username">
<input type="password" name="pwd">
<input type="password" name="pwd1">
<input type="submit" name="btn" value="go"></form>