Jump to content

Archived

This topic is now archived and is closed to further replies.

takeiteasy

current link color

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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 --
<?php
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>“;}
?>

</body>
</html>
[/code]

That would display like this:

[url=http://Home]Home[/url]
[color=red][u]Elephants[/u][/color]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.