Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mouseovers and CSS

 
Dale DeMott
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks
Dale
------------------
By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)
 
Brian Glodde
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
onmouseover="this.style.backgroundColor='#CC0000';"
onmouseout="this.style.backgroundColor='#0000CC';"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic