Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] How can I change this using CSS


  • From: stevec at topdogstrategy.com (Steve Clason)
  • Subject: [Javascript] How can I change this using CSS
  • Date: Wed Jul 20 14:29:14 2005

On 7/20/2005 12:42 PM Roland Dong wrote:

> I have the following working code:
> <div onmouseOver="style.backgroundColor='#FF00FF'; " onmouseOut=
> "style.backgroundColor='#FFFFFF'" class="cat">
> 
> 
> I want to move background color changing code to CSS. I tried something like
> this:
> 
> <div onmouseover: this.className="on" onmouseout:this.className="off"
> class="cat"> 
> 
> in style sheet add:
> 
> ................
> .off{ background: #D2D2EC; }
> .on { background: #FFFFFF; }
> .................
> 
> However, since there is already a "cat" class, it would override the "cat"
> class. 
> 
> Any suggestion?  

For what it's worth, an element can belong to two classes, e.g.

<div class="red bold">Word</div>

red{color:red}
bold{font-weight:bold}

...and "Word" will be both red and bold. I'm not sure if 
this.className="red bold" will work, though.
-- 
Steve Clason
Web Design and Development
Boulder, Colorado, USA
www.topdogstrategy.com
(303)818-8590