[转]js修改input的type属性的问题
2013-06-07 09:31
716 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>阿当制作</title>
</head>
<style type="text/css">
</style>
<body>
<input name="" type="text" value="密码" class="inputText_1" 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 = "密码";
}
</script>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>阿当制作</title>
</head>
<style type="text/css">
</style>
<body>
<input name="" type="text" value="密码" class="inputText_1" 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 = "密码";
}
</script>
</body>
</html>
相关文章推荐
- js修改input的type属性及浏览器兼容问题探讨与解决
- js修改input的type属性问题
- js修改input的type属性问题(兼容所有浏览器,主要用于密码类的默认有提示文字的效果)
- js修改input的type属性问题
- js修改input的type属性问题
- js修改input的type属性问题探讨
- js修改input的type属性问题探讨
- js修改input的type属性问题探讨
- js修改input的type属性及浏览器兼容问题探讨与解决
- js修改input的type属性问题
- js修改input的type属性问题
- JS 动态修改 input 的 type 属性
- JS 动态修改 input 的 type 属性
- js动态修改input输入框的type属性(实现方法解析)
- JS 动态修改 input 的 type 属性 - teresa502的专栏 - 博客频道 - CSDN.NET http://blog.csdn.net/teresa502/article/details/6546361
- js动态修改input输入框的type属性(实现方法解析)
- ie下input的type属性为hidden问题
- js 获取input type="file" 选择的文件大小、文件名称、上次修改时间、类型等信息
- 关于js修改css属性的一个小问题
- 网页中通过js修改img的src属性刷新图片时,图片缓存问题现象表述及问题解决