JS鼠标点击密码框提示文字就消失,鼠标移出密码框提示文字就再出现怎么做?不是文本框,而是密码框
<scripttype="text/javascript">window.onload=function(){varpwd=document.getElementById...
<script type="text/javascript">
window.onload=function(){
var pwd = document.getElementById("password");
var pwd_text = document.getElementById("password_text");
pwd_text.onfocus = function(){
pwd.style.display = "inline";
pwd_text.style.display = "none";
pwd.focus();
}
pwd.onblur=function(){
if(pwd.value==null || pwd.value=="" || pwd.value=="请输入密码"){
pwd.style.display="none";
pwd_text.style.display="inline";
}
}
}
</script>
<style type="text/css">
#inputs{width:300px;margin:50px auto;border:solid 1px #090;}
#password{display:none;}
</style>
<div id="inputs">
<input id="password" type="password" />
<input id="password_text" type="text" value="请输入密码" />
</div> 展开
window.onload=function(){
var pwd = document.getElementById("password");
var pwd_text = document.getElementById("password_text");
pwd_text.onfocus = function(){
pwd.style.display = "inline";
pwd_text.style.display = "none";
pwd.focus();
}
pwd.onblur=function(){
if(pwd.value==null || pwd.value=="" || pwd.value=="请输入密码"){
pwd.style.display="none";
pwd_text.style.display="inline";
}
}
}
</script>
<style type="text/css">
#inputs{width:300px;margin:50px auto;border:solid 1px #090;}
#password{display:none;}
</style>
<div id="inputs">
<input id="password" type="password" />
<input id="password_text" type="text" value="请输入密码" />
</div> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询