|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
using css class to handle events
is there a way I can do something similar to this?
.myClass { onMouseOver: background: #000080 onMouseOut: background: #ffffff } I would like to have css classes that encapsulate all of the event handlers that I need to reduce the redundant html in my pages. thanks, david |
|
#2
|
||||
|
||||
|
in standard compliant browsers you can use the pseudo-class hover on any element.
.myClass { background: #ffffff; } .myClass:hover { background: #000080; } ie. <p class="myClass"> |
|
#3
|
|||
|
|||
|
Thanks for your reply.
can handle events like onclick and blur in a similar manner? |
|
#4
|
||||
|
||||
|
I've been searching for the answer to this too, but it looks like unfortunately Microsoft Internet Explorer (my browser, and let's face it, almost everybody elses) can't handle :hover on anything but the <a> tag.
This means if you're doing a page with multiple rollover images (a menu for instance) you will have to add a javascript "onMouseOver" event handler to every (yawn) image tag you want to react to mouseOver. Fortunately, IE offers HTC behaviors, which offer amazing functionality and event handling, but I'm a bit suspicious that Netscape and co might not be able to use them. Any high level users listening who can add to this? bob |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > using css class to handle events |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|