PDA

View Full Version : mouseover and mouseout with CSS


delphi_dawg
03-09-2002, 12:00 PM
Hi all,

Code snippet -

<tr class="r_primary" style="cursor:hand" onClick="window.open()" onMouseOver=this.style.backgroundColor="#FFFFCC"
onMouseOut=this.style.backgroundColor="#CCFFFF" >


Question is - how do i use the values in the CSS instead of the hard coded html values for the backgorund colors?

I have three classes -
r_primary
r_alternate
r_highlight

and based on the action of the mouse - choose the appropriate color...

thanks
tony

COBOLdinosaur
03-09-2002, 02:53 PM
The best way to do it is to change the className:

<style>
rPrimary {cursor:hand; background-color:white}
rPrimary2 {cursor:hand; background-color:chocolate }
<style>

Then:

<tr class="r_primary" onClick="window.open()" onMouseOver="this.className='rPrimary2'"
onMouseOut="this.className=rPrimary'">

That makes it easy to maintain.

Do not use underscores in CSS class names. Any browser that complies to the standard will not pick up the class becasue _ is not a legal character in CSS.

_mrkite
03-10-2002, 09:47 PM
?????

http://www.w3.org/Talks/1999/0830-tutorial-unicode-mjd/slide39-0.html

COBOLdinosaur
03-11-2002, 07:28 AM
-mrkite,

read it again "- A-Z a-z 0-9 and any character greater than 160" underscore is 95.

HTML allows underscore. CSS does not.

HTML and CSS are not case sensitve but XML is, so there are additional problems coming for XHTML compatibility.

scoutt
03-11-2002, 11:01 AM
Almost everything is case-insensitive.

it says right on Netscape 6.2 site that it is case sensitive. granted it may be the browser that is case sensitive.

delphi_dawg
03-11-2002, 08:15 PM
Thanks to everyone who answered -

It worked well -
thank you.


sorry about the cross posts

take care
tony

Jon Hanlon
03-14-2002, 02:03 PM
The final word on underscrores from Netscape:
http://developer.netscape.com/evangelism/docs/technotes/css-underscores/

(They say don't use 'em.)