页面代码:
复制代码 代码如下:
<table>
<tr><td><input type="text" id="txtPwd" /></td></tr>
<tr><td>
<table id="pwdLever">
<tr>
<td>弱</td>
<td>中</td>
<td>强</td>
</tr>
</table>
</td></tr>
</table>
样式:
复制代码 代码如下:
<style type="text/css">
#pwdLever td
{
background-color:Gray;
width:45px;
text-align:center;
}
</style>
js代码:
复制代码 代码如下:
<script type="text/javascript">
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.backgroundColor = "gray";
}
else if (num == 2) {
tds[0].style.backgroundColor = "red";
tds[1].style.backgroundColor = "red";
tds[2].style.backgroundColor = "gray";
}
else if (num == 3) {
tds[0].style.backgroundColor = "red";
tds[1].style.backgroundColor = "red";
tds[2].style.backgroundColor = "red";
}
else {
tds[0].style.backgroundColor = "gray";
tds[1].style.backgroundColor = "gray";
tds[2].style.backgroundColor = "gray";
}
}
}
function pwdChange(v) {
var num = 0;
var reg = /\d/; //如果有数字
if (reg.test(v)) {
num++;
}
reg = /[a-zA-Z]/; //如果有字母
if (reg.test(v)) {
num++;
}
reg = /[^0-9a-zA-Z]/; //如果有特殊字符
if (reg.test(v)) {
num++;
}
if (v.length < 6) { //如果密码小于6
num--;
}
return num;
}
</script>
验证,密码,强弱
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。