页面代码:
|
样式:
#pwdLever td
{
background-color:Gray;
width:45px;
text-align:center;
}
js代码:
window.onload = function () {
var textInput = document.getElementById("txtPwd");
//给密码输入框 注册键放开事件
textInput.onkeyup = function () {
var pwdValue = this.value;
var num = pwdChange(pwdValue);
var tds = document.getElementById("pwdLever").getElementsByTagName("td");
//修改密码颜色
if (num == 0 || num == 1) {
tds[0].style.backgroundColor = "red";
tds[1].style.backgroundColor = "gray";
tds[2].style.backgro