我怎样才能既使用 HTML 密码输入又设置一个可读的文本默认值,因为密码输入会将字符变成点或星号?我可以用 JavaScript 做到这一点吗?
所以,如果我理解正确的话,你希望它读取“密码”或普通字母的任何内容,直到有人点击它,此时它会变成空白,并且在那里输入的任何内容都会变成*?好吧,你想要的是这样的:
in head:
<script type="text/javascript">
function changefield(){
document.getElementById("passwordbox").innerHTML = "<input id=\"password-field\" type=\"password\" name=\"password-field\" title=\"Password\" />";
document.getElementById("password-field").focus();
}
</script>
在身体里:
<div id="passwordbox">
<input id="password-field" type="text" name="password-field" title="Password" onfocus="changefield();" value="password" />
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)