这是一个完整的 <script>
function check(frm){
if(!/^[\w._-]{4,20}$/.test(frm.username.value)){
alert("username [4,20]");frm.username.select();return false;
}
if(!/^\w{8,16}$/.test(frm.pwd.value)){
alert("pwd [8,16]");frm.pwd.select();return false;
}
return true;
}
</script>
<form action=ok.aspx onsubmit='return check(this)'>
<input name=username>
<input type=password name=pwd>
<input type=submit value=submit>
</form>
function check(frm){
if(!/^[\w._-]{4,20}$/.test(frm.username.value)){
alert("username [4,20]");frm.username.select();return false;
}
if(!/^\w{8,16}$/.test(frm.pwd.value)){
alert("pwd [8,16]");frm.pwd.select();return false;
}
return true;
}
</script>
<form action=ok.aspx onsubmit='return check(this)'>
<input name=username>
<input type=password name=pwd>
<input type=submit value=submit>
</form>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货