一些容易的笔记

一些简单的笔记
这是用来设置密码框里的value值得
<input name="" type="text" value="密码" id="tx" style="width:100px;"  />              
<input name="" type="password" style="display:none;width:100px;" id="pwd" />
<script type="text/javascript">
var tx = document.getElementById("tx"), pwd = document.getElementById("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 = "密码";
}