密码:<input id="txt" οnblur="CheckPassword(this.value)"><label id=n></label>
<script>
function EvaluatePassword(word)
{
if (word == "")
{
return 0;
}
else if (word.length < 6)
{
return 1;
}
else
{
return word.match(/[a-z](?![^a-z]*[a-z])|[A-Z](?![^A-Z]*[A-Z])|d(?![^d]*d)|[^a-zA-Zd](?![a-zA-Zd]*[^a-zA-Zd])/g).length;
}
}
function CheckPassword(password)
{
document.getElementById("n").innerText = function (pwd)
{
switch (EvaluatePassword(pwd))
{
case 0:
return "未输入";
case 1:
return "太简单";
case 2:
return "还可以";
case 3:
return "比较强";
case 4:
return "非常强";
}
}(password)
}
</script>
简单密码强度
最新推荐文章于 2021-12-09 15:45:17 发布