如何编辑HTML输入值颜色?

在我的输入字段(文本)中,我有一个文本,一旦被单击就会消失.如何通过编辑颜色使这个文本变浅?

对不起,代码看起来很乱,我不得不把它砍掉来告诉你.

谢谢!

詹姆士

<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>

解决方法

也许这样的事情(只需添加你的风格):
<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" />

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些