頁面代碼: 複製碼 程式碼如下: 偏好 ctd> 強 樣式: 複製代碼 代碼如下: #pwdLever td { text-align:center; } js程式碼: 複製程式碼 程式碼如下: <BR> window.onload = function () {<BR> //給密碼輸入框註冊鍵放開事件<BR> textInput.onkeyup = function () {<BR> var num = pwdChange(pwdValue);<BR> var tds = document.getElementById("pwdLeverId("pwdLeverId("pwdLeverId("pwdLeverId("pwdLeverId("pwdLever ").getElementsByTagName("td");<BR> //修改密碼顏色<BR> tds[0].style.backgroundColor = "red" ;<BR> ";<BR> }<BR> 🎜> 以中[0].style.backgroundColor = "red";<BR> 🎜> tds[2].style.backgroundColor = "gray";<BR> }<BR> else if (num == 3) {<BR> tds[1].style.backgroundColor = "red";<BR> 2].style.backgroundColor = "red";<BR> }<BR> tds[0].style.backgroundColor = "gray";<BR> ";<BR> tds[2].style.backgroundColor = "gray";<BR> }<BR> }<BR> function pwdChange(v) {<BR> }var reg = /d/; //如果有數字<BR> 🎜> reg = /[a-zA-Z]/; / }/如果有字母<BR> if (reg.test(v)) {<BR> <BR> reg = /[^0-9a-zA-Z]/; //如果有特殊字元<BR> num ;<BR> }<BR> if (v.length < 6) { //如果密碼小於6<BR> num--;<BR> > }<BR>