Hi, I want to use a visited link color so people see what they've clicked on. Yet, from a designers perspective, I'd like to present a fresh array of unvisited links at the next visit.
In order to achieve this I started with a Java Script which you can check out here. When you click on a link it changes color and it memorizes it until you refresh the page :-)
PS: the challenge is also discussed in the PHP forum here.
Now I want to control the unvisited and hover colors, as well as the "current page" color with CSS. However hovering only works when the link has not been clicked and it does not work at all on the currentpage link. Furthermore the currentpage link does not change color at all :-(
I've tried a lot to find the solution but came to an end. I assume that the JavaScript has to be improved? Please help.
Thank you,
Martin
In order to achieve this I started with a Java Script which you can check out here. When you click on a link it changes color and it memorizes it until you refresh the page :-)
PS: the challenge is also discussed in the PHP forum here.
Now I want to control the unvisited and hover colors, as well as the "current page" color with CSS. However hovering only works when the link has not been clicked and it does not work at all on the currentpage link. Furthermore the currentpage link does not change color at all :-(
I've tried a lot to find the solution but came to an end. I assume that the JavaScript has to be improved? Please help.
Thank you,
Martin
Code:
<script type="text/javascript" language="JavaScript"><!-- function changeColor(id) { document.getElementById(id).style.color = 'green'; } //--></script>
Code:
<style type="text/css"> .navlink, .navlink A:link, .navlink A:visited { color: red; } .navlink A:hover, .navlink A:active { color: gray; } #currentpage { color: black; } </style>
Code:
<DIV class="navlink"><a href="http://www.google.com" onclick="changeColor(1)" id="currentpage";><span id="1">Link1</span></a></DIV> <DIV class="navlink"><a href="http://www.ask.com" onclick="changeColor(2)";><span id="2">Link2</span></a></DIV>
Comment