直接给 input type="password"的输入框赋值不行,由于安全因素,不允许对密码框赋默认值,只能通过键盘的方式输入值。而又要在密码框显示*密码,换个思路使用简单的js脚本即可实现这个效果。
<input type="password" id="txtPass" style="display:none;" runat="Server"/><input type="text" runat="server" id="txtValue" value="******" onclick="RZJ_SetPwd()"/>
<br /><input type="password" id="txtOkPass" style="display:none;" runat="Server" />
<script type="text/javascript">
function RZJ_SetPwd()
{
var txt1=document.getElementById("txtValue");
var txt2=document.getElementById("txtPass");
var txt3=document.getElementById("txtOkPass");
txt1.value="";
txt1.style.display="none";
txt2.style.display="";
txt3.style.display="";
txt2.focus();
}
</script>
转载请注明原文地址: https://www.6miu.com/read-24328.html