<html xmlns="http://www.w3.org/1999/xhtml" >
<script language="javascript" type="text/javascript">
// JScript 文件
function getStar(control,logValue,txt)
{
if(control.value==logValue)
{
control.value="";
control.style.color="black";
if(control.type=="text"){
control.style.display = "none";
document.getElementById('pass').style.display = "block";
document.getElementById('pass').style.color="black";
document.getElementById('pass').value="";
document.getElementById('pass').focus();//加上
}else{
var pass = document.getElementById('pass').value;
if(pass.length<1){
control.style.display = "none";
document.getElementById('log').style.display = "block";
}
}
}
}
function GetEnd(control,logValue,txt)
{
if(control.value=="")
{
control.value="输入内容";
control.style.color="gainsboro";
if(control.type=="password"){
control.style.display = "none";
document.getElementById('log').style.display = "block";
document.getElementById('log').value="输入内容";
document.getElementById('log').style.color="gainsboro";
//document.getElementById('log').focus();//加上
}
else{
var pass = document.getElementById('log').value;
if(pass.length<1){
control.style.display = "none";
document.getElementById('log').style.display = "block";
}
}
}
}
</script>
</head>
<body>
<input id="log" name="log" value="输入内容" style="width: 169px; color: gainsboro" type="text" οnfοcus="getStar(this,'输入内容','password')"/>
<input id="pass" name="pass" style="display:none; width: 169px;" type="password" οnblur="GetEnd(this,'输入内容','password')" />
</body>
</html>
<script language="javascript" type="text/javascript">
// JScript 文件
function getStar(control,logValue,txt)
{
if(control.value==logValue)
{
control.value="";
control.style.color="black";
if(control.type=="text"){
control.style.display = "none";
document.getElementById('pass').style.display = "block";
document.getElementById('pass').style.color="black";
document.getElementById('pass').value="";
document.getElementById('pass').focus();//加上
}else{
var pass = document.getElementById('pass').value;
if(pass.length<1){
control.style.display = "none";
document.getElementById('log').style.display = "block";
}
}
}
}
function GetEnd(control,logValue,txt)
{
if(control.value=="")
{
control.value="输入内容";
control.style.color="gainsboro";
if(control.type=="password"){
control.style.display = "none";
document.getElementById('log').style.display = "block";
document.getElementById('log').value="输入内容";
document.getElementById('log').style.color="gainsboro";
//document.getElementById('log').focus();//加上
}
else{
var pass = document.getElementById('log').value;
if(pass.length<1){
control.style.display = "none";
document.getElementById('log').style.display = "block";
}
}
}
}
</script>
</head>
<body>
<input id="log" name="log" value="输入内容" style="width: 169px; color: gainsboro" type="text" οnfοcus="getStar(this,'输入内容','password')"/>
<input id="pass" name="pass" style="display:none; width: 169px;" type="password" οnblur="GetEnd(this,'输入内容','password')" />
</body>
</html>