所以我有一个密码字段,其值设置为“密码”。我有一些非常简单的JavaScript,它将值设置为“onfocus”。像往常一样,我想要将密码屏蔽掉,并用点代替。问题是,如果我将该字段设为密码字段,则原始值“密码”将显示为点。有没有简单的方法来使原始值“密码”,其余的,在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>
只是想知道,有没有什么办法改变占位符文本的颜色/透明度? – Tommay 2015-04-03 15:59:59
http://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css – Touffy 2015-04-03 16:06:07