密码框问题

来源:互联网 发布:js获取当前日期并显示 编辑:程序博客网 时间:2024/06/06 01:23
密码框问题
当你写入密码的时候,希望输入的密码不是明文的那么就需要下面的代码
var tx = document.getElementByIdx_x("tx"),pwd = document.getElementByIdx_x("pwd");
tx.onfocus = function(){
  if(this.value != "密码") return;
  this.style.display = "none";
  pwd.style.display = "";
  pwd.value = "";
  pwd.focus();
}
pwd.onblur = function(){
  if(this.value != "") return;
  this.style.display = "none";
  tx.style.display = "";
  tx.value = "密码";
}
 
原创粉丝点击