This topic created in 3807 days ago, the information mentioned may be changed or developed.
<input type="text" name="" id="" value="颜色" class="gray" onclick="if(this.value=='初始值'){this.value='';this.className='black'}" onblur="if(this.value=='') {this.value='初始值';this.className='gray'}" />
上面这个 value="颜色" 求问怎么设置这个值的颜色
3 replies • 2016-01-05 11:17:45 +08:00
 |
|
1
Mak Jan 5, 2016 1
``` <style> .gray { color: #999; } .black { color: #222; } </style> ```
你后面那坨东西,正确的做法应该是:
``` <input type="text" placeholder="初始值" /> ```
对于不支持 `placeholder` 的浏览器,用 JS 去搞他。
|
 |
|
3
comanboy Jan 5, 2016
我還是沒看明白樓主要說的什麼意思。
|