在我的输入字段(文本)中,我有一个文本,一旦被单击就会消失.如何通过编辑颜色使这个文本变浅?
对不起,代码看起来很乱,我不得不把它砍掉来告诉你.
谢谢!
詹姆士
<form>
<input type="text" name="search" size="35"
onclick="this.value='';"onfocus="this.select()"
onblur="this.value=!this.value?'Job Title
e.g. Assistant Manager':this.value;"
value="Job Title e.g. Assistant Manager"
style="background-color:white; border:
solid 1px #6E6E6E; height: 30px; font-size:18px;
vertical-align:9px"/>
<input type="text" name="searchterm" size="35"
style="background-color:white; border: solid 1px #6E6E6E;
height: 30px; font-size:18px; vertical-align:9px"/>
<input type="image" src="but.tiff" alt="Submit" width="60">
</form>
Run Code Online (Sandbox Code Playgroud)
Boj*_*vić 16
也许这样的事情(只需添加你的风格):
<input type="text"
size="35"
value="Job Title e.g. Assistant Manager"
style="background-color:white;
border: solid 1px #6E6E6E;
height: 30px;
font-size:18px;
vertical-align:9px;color:#bbb"
onfocus="if(this.value == 'Job Title e.g. Assistant Manager') {
this.value = '';
this.style.color='#000';
}" />
<input type="text"
name="searchterm" size="35"
style="background-color:white;
border: solid 1px #6E6E6E;
height: 30px;
font-size:18px;
vertical-align:9px" />
Run Code Online (Sandbox Code Playgroud)