in script tag
function ispwd() {
var pwdreg= ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$; //here '^' and '\' are shown invalid characters
var pwdval=$("#pwd").val();
if(!pwdreg.test(pwdval))
{
$("#pwd").after('<span class="error">the password must be 4-8 chars and include at least one upper case letter, one lower case letter, and one numeric digit.</span>');
$("#pwd").focus();
}
}
in html
<p>Password<input type="password" id="pwd" onblur="ispwd()"/></p>
onblur from password 错误提示 javascript error: 'ispwd' is not defined。