javascript控制显示隐藏密码,废话少说,直接上代码,原理很简单,就是修改密码框的type属性
<input type="password" value="523654" name="password" id="password"><input type="checkbox" onclick="ps()"/>显示密码
<script language=javascript>
var showPwd=false;
function ps(){
var pwd=document.getElementById("password");
if(showPwd){
pwd.setAttribute("type", "password");
showPwd=false;
}else{
pwd.setAttribute("type", "text");
showPwd=true;
}
}
</script>