<html>
<!--样式-->
<style type="text/css">
#c { position: relative;}
#a { position: absolute; left: 10; top: 10; font-size: 12px; font-family: 宋体; }
#b { position: absolute; left: 10; top: 10; font-size: 12px; font-family: 宋体; -moz-opacity:0;opacity: 0;filter: alpha(opacity=0); }
</style>
<body>
<div id="c">
<input id="a" />
<input id="b" οnkeyup="document.getElementById('a').value=this.value.replace(/./g,'*');" />
</div>
</body>
</html>
<!--样式-->
<style type="text/css">
#c { position: relative;}
#a { position: absolute; left: 10; top: 10; font-size: 12px; font-family: 宋体; }
#b { position: absolute; left: 10; top: 10; font-size: 12px; font-family: 宋体; -moz-opacity:0;opacity: 0;filter: alpha(opacity=0); }
</style>
<body>
<div id="c">
<input id="a" />
<input id="b" οnkeyup="document.getElementById('a').value=this.value.replace(/./g,'*');" />
</div>
</body>
</html>
想改变密码框输入后的显示效果,是星号还是圆点,只需将replace中的* 改变
<!--网上搜索-->
转载于:https://blog.51cto.com/237451446/425988