Yes, try it. But you can accomplish the same thing with pure CSS and no javascript at all.

<style type="text/css">
element:hover{
background:url(btn_over.gif) no-repeat 50% 50%;
}
element:hover{
background:url(btn.gif) no-repeat 50% 50%;
}
</style>
You can use :hover and :active pseudo-classes to any element except in IE where those are only applicable to links. But there's a fix (http://www.vladdy.net/demos/iepseudoclassesfix.html) for IE without putting onmouseover and onmouseout handlers to each element.

quentin

05-31-2005, 08:02 PM

I dont need CSS code I need javascript code
CSS is not a problem

thank you

glenngv

06-01-2005, 08:07 AM

Javascript is more often disabled than CSS. So if you rely on pure Javascript solution and javascript is disabled or not supported by the browser, the functionality is lost. Moreover, CSS solution is easier to implement. You don't have to attach onmouseover and onmouseout handlers for all the elements. You just declare it one time in CSS and automatically the behavior is applied to all the elements.