PDA

View Full Version : CSS Classes & Event Handlers


mothra
07-26-2003, 11:02 PM
Is it possible to add event handlers to CSS classes yet? I read the BECSS document published by the W3C, it sounds this was never implemented though.

If this is possible please provide an example, something like:

table.menu
{
onmouseover : myEventHandler()
onmouseout : anotherEventHandler()
}

Thanks,
M.

meow
07-26-2003, 11:24 PM
Heh. I thought they had iced that. Odd, I find no mention of it either on w3's mailing lists or elsewhere after early 2000. :confused:

mothra
07-27-2003, 06:28 PM
I just figured it didn't fly because there isn't any info out there on the web.

poop.

brothercake
07-27-2003, 06:57 PM
You can have :hover and :focus on arbitrary elements

element { ... styles ... }
element:hover { ... styles ... }

which you can use to make mouseover effects, even menus and stuff.

You also have DHTML behaviors for IE, which allows to to attach functions to elements via CSS; and mozilla has something called XBL which (I think) is implemented in essentially the same way, although beyond that it's probably very different.

mothra
07-28-2003, 05:16 PM
I'll check this out. The XBL stuff sounds like mozilla's verison of HTC. Either way it seems like they encapsulate functionality which is what I want... was just hoping there was a x-browser answer within the css itself. oh well.

M