日期:2014-05-17  浏览次数:20876 次

怎么显示密码
<input type = "password" value = "1234">
写个js,怎么显示密码输入框里的值,急用
本人新手,谢谢照顾

------解决方案--------------------
什么意思? 你要显示 就不用 type="password"这个不就行了嘛?用普通的输入框就行
------解决方案--------------------
<input type = "text" value = "1234"> 显示的是明文
<input type = "password" value = "1234"> 显示的是密文

说实话,没看明白你想要啥呵呵


------解决方案--------------------
HTML code

<html>
<head>
<title>测试密码显示</title>
<script>
function getPassword(){
var passwordObj=document.getElementById("password");
alert("密码是:"+passwordObj.value);
}
</script>
</head>

<body>
密码:<input type="password" value="" name="password" id="password"/>
<br/>
<input type="button" value="获取密码" onClick="getPassword();"/>
</body>
</html>

------解决方案--------------------
HTML code

<script type="text/javascript">
function ps()
{
    if (this.forms.password.type="password")
    box.innerHTML='<input type="html" name="password" size="20" value="'+this.forms.password.value+'">';
    click.innerHTML='<a href="javascript:txt()">隐藏密码</a>'
}
function txt()
{
    if (this.forms.password.type="text")
    box.innerHTML='<input type="password" name="password" size="20" value="'+this.forms.password.value+'">';
    click.innerHTML='<a href="javascript:ps()">显示密码</a>'
}
</script>
<form method="post" action="" name="forms">
<span id="box"><input type="password" name="password" size="20" value="sina.com"></span>
<span id="click"><a href="javascript:ps()">显示密码</a></span>
</form>