<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<input name="" type="text" value="密码" id="tx" style="width:100px;" />
<input name="" type="password" style="display:none;width:100px;" id="pwd" />
<input name="" type="text" value="确认密码" id="tx1" style="width:100px;" />
<input name="" type="password" style="display:none;width:100px;" id="pwd1" />
<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 = "密码";
}
var tx1 = document.getElementById("tx1"), pwd1 = document.getElementById("pwd1");
tx1.onfocus = function(){
if(this.value != "确认密码") return;
this.style.display = "none";
pwd1.style.display = "";
pwd1.value = "";
pwd1.focus();
}
pwd1.onblur = function(){
if(this.value != "") return;
this.style.display = "none";
tx1.style.display = "";
tx1.value = "确认密码";
}
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<input name="" type="text" value="密码" id="tx" style="width:100px;" />
<input name="" type="password" style="display:none;width:100px;" id="pwd" />
<input name="" type="text" value="确认密码" id="tx1" style="width:100px;" />
<input name="" type="password" style="display:none;width:100px;" id="pwd1" />
<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 = "密码";
}
var tx1 = document.getElementById("tx1"), pwd1 = document.getElementById("pwd1");
tx1.onfocus = function(){
if(this.value != "确认密码") return;
this.style.display = "none";
pwd1.style.display = "";
pwd1.value = "";
pwd1.focus();
}
pwd1.onblur = function(){
if(this.value != "") return;
this.style.display = "none";
tx1.style.display = "";
tx1.value = "确认密码";
}
</script>
</body>
</html>