View Full Version : textarea onClick?
08-08-2004, 03:51 PM
Hi there... Do uknow how i can change the color of a textarea when a user clicks on it? Do u know which browsers support this feauture?Thx
<textarea name="t1" onclick="this.style.backgroundColor='red' "></textarea>
08-08-2004, 05:42 PM
Thx...do u know if this is possible using stylesheets?
I ask because in this format it is not easy to make changes...
08-08-2004, 06:44 PM
You can use the css pseudoclass :focus, but the support for it is pretty poor. Check out the support chart for it [here (http://www.macedition.com/cb/resources/css3support_selectors.html)]. I probably shouldn't say that the support is poor, it's just that IE doesn't like it at all.
08-08-2004, 08:29 PM
You want this:
onclick="this.style.backgroundColor='red'" (Background color)
onclick="this.style.color='red'" (text color)
08-08-2004, 10:46 PM
<textarea class="txt_blue" onfocus="this.className='txt_red'" onblur="this.className='txt_blue'" cols="30" rows="7">The style of this text area is dynamically controlled</textarea>
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.