/    Sign up×
Community /Pin to ProfileBookmark

changing a link color in an external javascript file

Hello Everyone,

I have a css style sheet with all my links to be the color black by default.

I also have a function that changes the color of the link onmouseover which is the following:

[CODE]function changeColorHeader(els) {
els.style.color = “#1569c7”;
//add another function to change back to its original color
if(document.addEventListener) {
els.addEventListener(“mouseout”, function () { els.style.color = “black”; }, false);
} else if(document.attachEvent) {
els.attachEvent(“onmouseout”, function() { els.style.color=”black”;});
}
//this area is missing
return; // this area is missing
}// this is the missing (}) code that triggers the error[/CODE]

I’d like to make a CERTAIN link a different color from the default so it can stand out.

How can I do that?

I have tried the following:

Code:

<span style=”color:#ff0000;”> test </span>

inside the
Code:

<a href> </a>

And what that does is that it does change the link color to RED which is what I have there, but the onmouseover to change the link doesn’t work, it says RED the whole time.

Is there something in my original code that I can tweak to basically just have that link show up with a different color and then have the option of a different color onmouseover?

I also tried writing a class in CSS:

Code:

A.red:link {color: #ff0000; text-decoration: none;}

And that didn’t work either…

Any info would be greatly appreciated!!

Thanks!

WD

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@wdes2009authorSep 15.2009 — never mind, the "class" in the css works, just had it put in the wrong <A> tag

Thanks guys,

WD
×

Success!

Help @wdes2009 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...