Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok the code is

 

 

<td height="15" onMouseover="this.style.backgroundColor='#CC3333'; " onMouseout="this.style.backgroundColor='#FFFFFF'; "><div align="center" class="fontred" id = "1">

Text</div></td>

 

 

How can I change font color onMouseOver

 

I tried this.1.style.color = '#FFFFFF'; but nothing

 

Thanks

Igor

  • *Experts*
Posted

Assuming the "1" in "this.1.style..." is the div, I'd use a name that starts with an alpha. Try replacing "1" with "a1" or something.

 

You can also use onMouseover and onMouseout on the div tag to change the foreground color. You could either change the style or the class since your div is already using one.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Something like this??

(I added href so DIV is out. I have to change the color of link.)

"l1" is ID of a tag.

 

<td height="15" class="borderleft" onMouseover="this.style.backgroundColor='#CC3333';

this.l1.style.class = 'class2'; " onMouseout="this.style.backgroundColor='#FFFFFF'; "><div align="center" >

<a href="some.htm" id = "l1" class="class1">text</a></div></td>

 

But this code wont work!

 

Igor

  • *Experts*
Posted

Ah, if it's a hyperlinke (anchor tag) that you want, simply set the "hover" style of the anchor tag in the stylesheet. Here's a sampe:

<html>
<style>
A:link
{
   COLOR: #FF0000;
   TEXT-DECORATION: none
}
A:visited
{
   COLOR: #800000;
   TEXT-DECORATION: none
}
A:active
{
   COLOR: #0000FF;
   TEXT-DECORATION: none
}
A:hover
{
   COLOR: #FFFF00;
   TEXT-DECORATION: underline
}
</style>
<body>
<table width="100%">
<tr>
	<td onMouseover="this.style.backgroundColor='#CC3333';" onMouseout="this.style.backgroundColor='#FFFFFF'">
		<div align="center"><a href="some.htm">hyperlink test</a></div>
	</td>
</tr>
</html>

 

You can also set the alignment on the TD if that's all you're using the DIV for.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

The problem is that link and cell hover colors are the same

 

When you roll mouse over cell it becomes red, and you have to go a llitle more to go over link.

 

I want to change the link color when I roll over table cell.

 

Thanks

Igor

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...