[thelist] javascript form question

Ben Glassman bglassman at gmail.com
Wed Jul 5 13:14:12 CDT 2006


There is actually a CSS pseudo class called :focus that you could use
the change the background color of all inputs when they are clicked on
(or tabbed to) which would be like this

input:focus {
background-color: red;
}

The alternative would be to add onclick event handlers to all input
elements using javascript that would either change the
style.backgroundColor value or (optimally) would add or remove a class
or ID (probably an ID since the element which is selected would be
unique at any given time). You could then style this ID using CSS.

Ben

On 7/5/06, Bruce Gilbert <webguync at gmail.com> wrote:
> I have a form in which I am using PHP to submit, but I would also like
> to change the input background when the mouse is clicked within that
> field with CSS if possible and not sure exactly how to do it. I
> believe it would be an onClick event.
>
> An example of code for the input field would be:
>
> <input name="name" type="text" class="form_text" id="name"
> value="<?=$name ?>" />
>
> thanks for any assistance.
>
> Bruce Gilbert
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list