/    Sign up×
Community /Pin to ProfileBookmark

Hyperlink Repeat Change Text color Question

Hi is there a way (preferably keeping it all in a one line function like it is now) to have this hyperlink alternate between two different colors per click?

<a href=”#” onClick=”style.color=’#FFFFFF'”>Change Color Back and Forth after Each Click?</a>

Thank you.

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Aug 22.2008 — CSS is by far the easiest<i>
</i>a:hover {
color:#fff;
}
Copy linkTweet thisAlerts:
@theflyingminstauthorAug 22.2008 — Thanks Declan, is there are way to make it switch onclick though? Every time you click it should switch.
Copy linkTweet thisAlerts:
@Declan1991Aug 22.2008 — Sorry, I wasn't concentrating.<i>
</i>onclick="if(this.style.color='#org'||!this.style.color){this.style.color='#new'}else{this.style.color='#org'}"
Copy linkTweet thisAlerts:
@theflyingminstauthorAug 23.2008 — Cool, thanks Declan!
×

Success!

Help @theflyingminst 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.3,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

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