CSS: Change the color of the text on change event.

March 8th, 2009

<form>
<input type=”text” onChange=”this.style.color=’red’”>
</form>
</p>
<br>
<p class=”code”>
// Add this to the head section of your page
<style type=”text/css”>
textarea.normal { background-color:FFFFFF }
textarea.hilite { background-color:FFFFCC;color:0000FF }
.textbox_normal { background-color:#FFFFFF; }
.textbox_hilite { background-color:#FFFFCC;color:#0000FF }
</style>

<input type=”text” name=”textbox1″ size=”30″ maxlength=”40″ class=”textbox_normal” onFocus=”this.className=’textbox_hilite’” onblur=”this.className=’textbox_normal’”>

<textarea name=”textarea1″ cols=”100″ rows=”2″ wrap=”VIRTUAL” class=”normal” onFocus=”this.className=’hilite’” onblur=”this.className=’normal’”></textarea>

Tags:

2 Responses to “CSS: Change the color of the text on change event.”

  1. SEO Host coupon Says:

    I use Digg to find stories all the time. It’s great when you don’t have anything else to write about. Nice list.

  2. mattress Says:

    Lebeda http://zlebedau9mj9q0.AUTOPARTSTHAI.INFO/tag/Slumberland+mattress+Lebeda/ : mattress…

    Lebeda…

Leave a Reply

Filled Under: CSS