Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active state?

Status
Not open for further replies.

Beat

Technical User
Aug 26, 2001
41
0
0
SE
Hi,
I am building dynamic websites for my clients that allows them to update content and add pages to their websites themselves. One of the features I have is dynamic navigation that allows them to add/edit and remove menu items.

I almost always use a rollover state in the menu, but I have never been able to add an active state to it, that will highlight what page the visitor is on. And since it is a dynamic website that just refreshes the page with another record when you go to another page I havent been able to use the active state in CSS.

Can anyone help me out here?

Many thanks!
 
I'm using ASP to list the records from a database table to display the menu items. When the user creates the page in the admin they assign name, template and content which inserts variables that are then sent when the visitor clicks in the menu. The page refreshes and loads content depending on the variables.

I hope this is answering your question?

Thanks for helping out!
 
If you have for example four page "identities": page1, page2, page3 and page4, you can put an ID attribute in the body and link tags and then use CSS to style the "active" link.
Code:
<style type="text/css">
body#page1 a#page1link, body#page2 a#page2link, body#page3 a#page3link, body#page4 a#page4link { font-weight:bold; }
</style>
...
<body id="page1">
<a href="..." id="page1link">Page 1</a>
<a href="..." id="page2link">Page 2</a>
<a href="..." id="page3link">Page 3</a>
<a href="..." id="page4link">Page 4</a>
Alternatively you can just use a "current" class in the link tag and style it.
Code:
<a href="..." class="current">Page 1</a>
<a href="...">Page 2</a>
<a href="...">Page 3</a>
<a href="...">Page 4</a>

Hope it helps!

News and views of some obscure guy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top