Log in

View Full Version : Problem with addClassName and moseOver



areddy
07-27-2009, 02:59 PM
Hi,

I'm using the follwing code and css to highlight and underline the text once the mouse is hovered on the image.The text is changing the color once I hover on the image but it's not underlining the text although I have text-decoration:underline on css property.Could any body help me on this.
<code>
<a rel="nofollow" href="sample1.jsp" onmouseover="$('sampletext').addClassName('m-over');"
onmouseout="$('sampletext').removeClassName('m-over');"><img src="test1.gif/>
<a rel="nofollow" id="sampletext">Example1</a>
a:m-over{
color:orange:
text-decoration:underline
}
</code>
Thanks,
Kumar

TheJoshMan
08-03-2009, 08:57 PM
I first thought this should be posted in the javascript/jQuery section, but I see now that this is actually a CSS flub...

You are using your CSS classname improperly. You should use a.m-over rather than a:m-over.

Secondly, there is no CSS property of "colorrange"... If you would like to change the color of text using CSS, simply use "color" instead. Also, after each property/value combo, there must be a semi-colon in your css...

Try using:



a.m-over{
color:red;
text-decoration:underline;
}