<input type="text" οnblur="checkpass(this)" />
<script>
function checkpass(pass){
var txt=pass.value;
if (txt.length<8){
alert("必须至少8个字符长");
pass.focus();
return false;
}
if (!txt.match(/[a-z]/) || !txt.match(/[A-Z]/) || !txt.match(/[0-9]/))
{
alert("必须包括所有的字符以下类型:小写字母,大写字母和数字 ");
pass.focus();
return false;
}
}
</script>
<script>
function checkpass(pass){
var txt=pass.value;
if (txt.length<8){
alert("必须至少8个字符长");
pass.focus();
return false;
}
if (!txt.match(/[a-z]/) || !txt.match(/[A-Z]/) || !txt.match(/[0-9]/))
{
alert("必须包括所有的字符以下类型:小写字母,大写字母和数字 ");
pass.focus();
return false;
}
}
</script>