To set the background color of the textbox, use the ‘backgroundColor’ property.
eg.
<input type="text" style='background:#fce09a' value='www.fordevs.com'>
If you want to set the background color on text focus then use the ‘onfocus’ event.
The following example illustrates you how to set the color in ‘onfocus’ event. When the texbox loses the focus then normal background color is retained.
<html> <body> <br><input class="searchInput" id="searchtextbox" onblur="this.style.backgroundColor='#ffffff';" onfocus="this.style.backgroundColor='#fce09a';value=''" accesskey="s" value="[Enter your name]" name="searchtextbox" autocomplete="off"> <br> <br> </html>
Popularity: 7% [?]

October 19th, 2008
admin
Posted in
Tags:

