Re: Change style class on mouseover

by Peggi & Ben Rodgers <woodduck(at)mbay.net>

 Date:  Thu, 04 Jan 2001 08:00:19 -0800
 To:  "Mike Kear" <choicemag(at)hotmail.com>,
hwg-techniques(at)hwg.org
 In-Reply-To:  hotmail
  todo: View Thread, Original
Happy New Year to you and a Happy Birthday to Australia!

The easy way to do it is to use pseudo-class "hover".  Try:

a:hover{color: whatever;}

and see if that doesn't do what you're looking for.  You can also change 
the background by adding "background: whatever;" to that code which can 
give you a nice effect as you mouseOver.

HTH

Peggi


At 02:04 PM 1/4/01 +1100, Mike Kear wrote:
>Happy New Year everyone, and Happy 100th Birthday to Australia. (for those 
>who didn't know, Australia turned 100 years old on Jan 1st - at least the 
>current Commonwealth of Australia did - the country itself has been here, 
>inhabited and home to humans for 40,000 years plus)
>
>I'm trying to use style sheets to swap colours under the mouse cursor 
>instead of using graphics - I have a size problem with the total file, so 
>if I can eliminate all those graphics, I can save a lot of download time, 
>and also can make the nav buttons dynamic.
>
>Here's the elements -
>
>IN the table cell, I have the following:
>
><TD class=base onmouseout=mOut(this) onmouseover=mOvr(this)>Cell content 
>stuff</TD>
>
>And the two relevant javascript functions are as follows:
>
><SCRIPT LANGUAGE="JavaScript"><!--
>function mOvr(src){
>         src.style.cursor = 'hand'; src.bgColor = "#ffcc99";
>         }
>         function mOut(src)
>         {
>         src.style.cursor = 'default';src.bgColor = "#ffffff";
>         }
>//--></SCRIPT>
>
>At last, I get to the point:
>
>How can I have this function switch styles from my style sheet instead of 
>merely changing the background colour of the cell?  When the mouse is over 
>the cell I want it to switch from class='base' to class='mouseover'
>
>Cheers,
>Mike Kear
>AFP Web Development
>Windsor, NSW, Australia
>http://www.afp.zip.com.au
>
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Peggi Rodgers
Flash Programmer	
Tide Pool Enterprises
Pacific Grove, CA
prodgers(at)tide-pool.com

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA