如何编辑HTML输入值颜色?
发布时间:2020-12-14 23:38:06 所属栏目:资源 来源:网络整理
导读:在我的输入字段(文本)中,我有一个文本,一旦被单击就会消失.如何通过编辑颜色使这个文本变浅? 对不起,代码看起来很乱,我不得不把它砍掉来告诉你. 谢谢! 詹姆士 form input type="text" name="search" size="35" onclick="this.value='';"onfocus="this.sele
在我的输入字段(文本)中,我有一个文本,一旦被单击就会消失.如何通过编辑颜色使这个文本变浅?
对不起,代码看起来很乱,我不得不把它砍掉来告诉你. 谢谢! 詹姆士 <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" /> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |