// increase strength if contains non alpha
non_alpha_re = new RegExp([^AZaz]);
if (non_alpha_retest(input_str)) {
strength++;
}
// increase strength if contains upper case
upper_alpha_re = new RegExp([AZ]);
if (upper_alpha_retest(input_str)) {
strength++;
}
// increase strength if long enough
if(input_length >=) {
strength++;
}
var strength_str;
if (strength <= ) {
strength_str = <strong style=color:blue>弱</strong>;
} else if (strength <= ) {
strength_str = <strong style=color:blue>中等</strong>;
} else {
strength_str = <strong style=color:green>强壮</strong>;
}
if(input_strlength < ) {
strength_str = <strong style=color:orange>太弱</strong>;
}
output_displayinnerHTML = strength_str;
}
</script>
<div>
<span>密码强度: </span>
<span id=reg_passwd__strength_display__>
</span>
</div>
</div>
</form>
</body>
</html>
[] []