【发布时间】:2015-04-03 15:30:51
【问题描述】:
所以我有一个密码字段,其值设置为“密码”。我有一些非常简单的 javascript 将值设置为 '' onfocus。我希望像往常一样将密码屏蔽掉,用点代替。问题是,如果我将该字段设为密码字段,则原始值“密码”将显示为点。有没有什么简单的方法可以使原始值“密码”和其余的,在聚焦之后,点?还是我必须在 onfocus 之后将字体更改为只有点的自定义字体?
这是我的 HTML:
<!DOCTYPE html>
<html>
<head>
<title>SuM BUTtonsS DOe</title>
<link rel="stylesheet" href="buttons.css"/>
</head>
<body>
<p>Please enter the password.</p>
<form>
<input id="password" type="textbox" value="Password" onfocus="if (this.value=='Password') this.value='';" onblur="if (this.value=='') this.value='Password';"/>
</form>
</body>
</html>
【问题讨论】:
标签: javascript fonts passwords password-protection