/    Sign up×
Community /Pin to ProfileBookmark

change cell bg and text colours

[CODE]<td class=”bgcolor” onmouseover=”style.backgroundColor=’#000000′;” onmouseout=”style.backgroundColor=’rgb(161,8,3)'”>link here</td>[/CODE]

I am using the above code to change my cell background colour from dark red to black, and then back to dark red when the mouse is moved away from the cell. I would also like to change the colour of the link in the cell at the same time. What piece of code do I add and where?

Please help.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJul 17.2004 — you can use CSS to set a default mouseover / and default link color using

a{

color:blue;

}

a:hover{/*mouseover color */

color:green;

}

and if you want to use custome color as you have in your td you can use the same mousever/mouseout event code in the anchor tag

<a href="" onmouseover="style.backgroundColor='#000000';" onmouseout="style.backgroundColor='rgb(161,8,3)'">Link</a>

you have to make sure that any componenet inherits the same properties as parent if you want to make a child component to show the same effects as parent.
×

Success!

Help @W8_4me spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...