wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Mouseovers and CSS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Mouseovers and CSS" Watch "Mouseovers and CSS" New topic

Mouseovers and CSS

Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
Here's something for you to ponder. I have created buttons with CSS. Yes .. Cascading Style Sheets. It was a nice way to create buttons w/out having to create images for every single button I had. I then created a mouseover javascript method that would change the className when the mouse went over the object. This effectivly changed the color of the button when you were over it. Problem is, ie 5.5 doesn't work anymore with this. The mouseover works as well as the mouseout. I think the issue is that I can't dynamically change the class name of the style sheet anymore. Any ideas... (besides creating an image for every button I have) Is there an easy way to change the color of these stylesheets buttons when I mouseover them??? Tell me what you think.
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)

By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
Brian Glodde
Ranch Hand

Joined: Jun 27, 2001
Posts: 171
You can use "this.style.backgroundColor" to change the background of the div onmouseover/mouseout. You might have some issues with Netscape, but it all depends on the application. You can change most elements this way, so you wouldn't have to swap classnames at all.
subject: Mouseovers and CSS
Similar Threads
Netscape href issue
change CSS rules dynamic with JavaScript
problem about using javascript and css. pleas
Greying a Textbox
Question regarding changing button Type on JSP