takeiteasy Posted July 6, 2006 Share Posted July 6, 2006 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:[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}[/code] Quote Link to comment Share on other sites More sharing options...
bobleny Posted July 7, 2006 Share Posted July 7, 2006 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:[code]<html><head><title></title></head><body><?php $page = “elephants“; ?><!-- here is your menu --<?phpif (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>“;}?></body></html>[/code]That would display like this:[url=http://Home]Home[/url][color=red][u]Elephants[/u][/color] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.