View Full Version : Rollover


scottyboy
06-12-2003, 10:42 AM
I want my text to change colour on a rollover event. The text is not a link so I can't use a:hover to do this. Any suggestions?

lefty
06-12-2003, 02:42 PM
I assume it's an image?
http://www.lissaexplains.com/java3.shtml#images

scottyboy
06-13-2003, 08:06 AM
No, it is a piece of text

lefty
06-13-2003, 02:34 PM
Sorry, I had originally read that as it wasn't text, that was confusing. :lol:

If it's possible it would be a javascript attribute, but I don't know enough about it to write a script. I'll poke around and see what I can find, unless someone else comes along and can properly answer your question. :)

scottyboy
06-13-2003, 03:03 PM
After reading all sorts and asking everywhere, here is a method for giving text (that is not a link) a rollover effect:

//This bit goes in your style sheet settings:

div.m1 {font-family: Arial, helvetica; text-decoration:none; color:#ff0000; font-weight:bold font-size:12}
div.m2{font-family: Arial, helvetica; text-decoration:none; color:#00ff00; font-weight:bold; font-size:16}
div.m3{font-family: Arial, helvetica; text-decoration:none; color:#ff0000; font-weight:bold font-size:12}

//This bit goes in the body of your page:

<div id='cooltext' class='m1'
onMouseOver='document.getElementById("cooltext").className="m2"'
onMouseOut='document.getElementById("cooltext").className="m3"'>My Text</div>

You have to have the third class (here called m3) to return the text to its original colour (although I suppose you could have a third colour too).

lefty
06-13-2003, 03:30 PM
Well look at that! Glad you figured it out :)