View Full Version : Changing a link's color after clicking on it and staying on that page.
02-17-2010, 10:54 AM
Can anyone tell how to Change a link's color after clicking on it and staying on that page.Please help me its urgent.
Thanks in Advance .. :)
02-17-2010, 11:01 AM
This is not a PHP question, however: this would be done easiest I think by assigning an id to the link then using js to change the color e.g.
<a href="#" id="mylink" onclick="document.getElementById('mylink').style.color='red';return false;">Click me</a>
see http://www.metatest.co.uk/testclick.htm for live example.
02-17-2010, 11:37 AM
02-17-2010, 11:52 AM
One of us is missing the point: the OP said
after clicking on it and staying on that page
so having a cascade dependent style e.g. using page ids does not help.
Furthermore the :visited style will presumably not be applied until the page reloads hence the question (not tested the latter I must confess)
:hover and :active work when it is hovered and clicked but I don't think are persistent, so I cannot see any way to do this that does not involve javasccript, unless you reframe the question so that page reload is allowed, in which case it is trivial.
After some testing :active does actually remain on a link after clicking, but only until another link is clicked (or possibly it loses focus etc.) so may or may not be any use to OP :visited is a long term think and probably won't suit their purposes.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.