Jump to content


current link color

  • Please log in to reply
1 reply to this topic

#1 takeiteasy

  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 06 July 2006 - 04:48 AM

hi there,
i need someone to help me out here, currently, my navigation menu is made up of a few links.
I wanted to display a different color for the link which the user is currently viewing, so as to differentiate or to let the user know which part he is in currently.
Is there any such of codes?Can give me a sample code?

my current code:
a:link 	{text-decoration: none; color: #ffffff; cursor:crosshair}
a:visited {text-decoration: none; color: #0000CC; cursor:crosshair}
a:active	{text-decoration: underline; color: #444444; cursor:crosshair}
a:hover 	{text-decoration: underline; color: #6699FF; cursor:crosshair}

#2 bobleny

  • Members
  • PipPipPip
  • Advanced Member
  • 429 posts

Posted 07 July 2006 - 04:19 AM

Provided that the menu is on every page (though highly un-recommended), you do have the option to simply get rid of the link and replace it with text.

Other wise you could use php (of course there are always other options).

In php, one way to do this, though it may not be the best way to do this, you could assign each page its own variable and use php to decide which variable is on that page. You now know what page the user is on and can take the appropriate action.

For example:

Page: elephants.php:

<?php $page = “elephants“; ?>
<!-- here is your menu --
if (page = “home“){echo “<font color=“#ff0000”><u>Home</u></font>“;}
else {echo “<a href=“home.php”>Home</a></br>“;}

if (page = “elephants“){echo “<font color=“#ff0000”><u>Elephants</u></font>“;}
else {echo “<a href=“elephants.php”>Elephants</a></br>“;}


That would display like this:

-- www.firemelt.net --
First do me a favor and read this: JavaScript is NOT Java - Then read this: www.php.net - When your done with that, read this Topic
After that, floors open. I and anyone else will be MORE than happy to answer YOUR query! [Topic Solved]
Cheer up, the worst has yet to come...

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users