Hi StackOverflow,
I'm having some trouble with my main menu on my ASP.NET website. What I want is, when a user clicks on a link, it should change it's color to black and remain black until the user clicks on the other links.
In other words: I want to highlight the selected link.
So far I've got it working using some workaround JavaScript (should consider using jQuery instead I think), but the problem is, that the style dosn't remain on page postback (or so it seems..)
My current javascript:
<script type="text/javascript">
var last = "none";
function LinkSelector(link) {
if (last != "none") {
document.getElementById(last).className = "NormalLink";
}
document.getElementById(link).className = "ActiveLink";
last = link;
}
</script>
As I wrote, it sure changes the class name when clicked, but dosn't remain that way when the new page is loaded.
Anyone got a workaround on this? :)
Thanks in advance.
All the best,
Bo