<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Test</TITLE>
<script type="text/javascript">
function show(obj)
{
if(obj.type=="text")
{
obj.style.display = "none";
document.getElementById('pass').style.display = "block";
document.getElementById('pass').value="";
document.getElementById('pass').focus();
}
else
{
var pass = document.getElementById('pass').value;
if(pass.length<1)
{
obj.style.display = "none";
document.getElementById('txt').style.display = "block";
}
}
}
</script>
</HEAD>
<BODY>
<input id="txt" type="text" value="请输入密码" οnfοcus="show(this)" style="width:150px;height:20px">
<input id="pass" type="password" value="" style="display:none;width:150px;height:20px" οnblur="show(this)">
</BODY>
</HTML>
JavaScript 文本框变成密码框
最新推荐文章于 2023-11-19 14:55:56 发布