所以我有一個密碼字段,其值設置爲「密碼」。我有一些非常簡單的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