[thelist] event handlers in a stylesheet?

Athena Janiszewski athenaj at rogers.com
Mon Mar 11 23:27:01 CST 2002

What a coincidence that this came up - I just did this on my site a couple
of  days ago.


This site is just me messing around - its not meant to be serious and I just
threw it together recently, so please don't mind. . .plus you have to use IE
cause I just decided that this was for my own fun so forget about the
headaches of omaking it look good in other browsers - sorry for those who
are offended.

But anyone is free to view the source and steal my code. Its actually quite
basic. It doesn't work in netscape; I check the browser type on the server
side for the whole site so I didn't put a browser check in the javascript
for this css/form element stuff.


> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Ken Kogler
> Sent: Tuesday, March 12, 2002 12:08 AM
> To: thelist at lists.evolt.org
> Subject: RE: [thelist] event handlers in a stylesheet?
> OK, what about this?
> Create 2 classes - in this example I'll use 'focusOn' and 'focusOff'.
> Then, in the onClick handler for the form element, add a javascript
> function call. Looks like this:
> <input onClick="setStyle(this);">
> And the JavaScript looks like this (in English, not code):
> setStyle(formElement) {
>   change class to "focusOn"
>   change length to +10
>   }
> Then just do the opposite for onDeactivate.
> Lemme know if you need more help/clarification.
> I'm in the middle of writing an eVolt tutorial that does something much
> similar. It uses JavaScript functions to change the CSS className of a
> form element (like I'm suggesting here) when the data within is proven
> valid, using client-side form validation techniques.
> Feel free to poke around in my code and see it it's helpful at all...
> http://www.kenkogler.com/form/ Beware, though, that it's still a bit
> buggy as it's not meant to be published for quite some time yet.
> -kenKogler(.com)

More information about the thelist mailing list