下面是一个下拉搜索表单,我想更改显示的 this.value 句子中一个词的颜色。
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<input type="text" onfocus="if(this.value=='We'll steer you in the right direction') this.value='';" onblur="if(this.value=='') this.value='We'll steer you in the right direction';" value="We'll steer you in the right direction" name="s" id="s" /><br />
我希望以不同的颜色显示“转向”一词。
提前致谢。
最佳答案
您需要创建自己的控件才能做到这一点。 “富文本”框允许您控制文本框内的格式,请参阅 this question .
关于javascript - 以php形式更改一个输入单词的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13364485/