[thelist] MouseOver Table Cells

Joe Crawford jcrawford at avencom.com
Fri May 25 10:19:59 CDT 2001


on 5/25/2001 7:40 AM, Don Makoviney at DonM at allensysgroup.com wrote:

> I am mousing over table cells and changing the colors like this in ASP:
> 
> Response.Write ("<tr><td style='border-bottom:1px groove gray;cursor:hand'
> onMouseOver=""this.style.backgroundColor='#ffffdd'""
> onMouseOut=""this.style.backgroundColor=''""><b>" & objItem &
> "</b></td><td>" & Request.QueryString(objItem) & "</td></tr>")
> 
> 
> However, instead of hardcoding these colors in like I have above, I would
> like to specify these colors in a CSS file, but I am having a hard time
> finding the equivalent way to do it there.

You can call this.style.className - then have the class name in your CSS
which the page access (could be on the page, could be in a linked
stylesheet).

<td
    onmouseover="this.className='yellowThing';"
    onmouseout="this.className='whiteThing';">hello</td>

So you need whiteThing and yellowThing classes:

<style type="text/css">
<!--
.yellowThing {
background: #FF9;
}
.whiteThing {
background: #FFF;
}
//-->
</style>

I have something similar here:
http://www.artlung.com/temp/tr-onmouseover-style.html

But I really need to move it to http://www.artlung.com/lab/ somewhere.

HTH,
    Joe
--
Joe Crawford ||||||||||||||       mailto:jcrawford at avencom.com
||||||||||||||||||||||||             http://www.avencom.com
|||||||||||||||||||||||||||      Avencom: Set Your Sites Higher






More information about the thelist mailing list