Forum Moderators: open
For example if the user is viewing the "Contact" page then the "Contact" link on the menu will be highlighted
to show the current page displayed.
Is this possible?
This is the code that I am using for my menu system
(Thanks in advance)
<%
oSql = "SELECT * FROM Menu WHERE Menu.ViewCategory=True"
Set oRS = oASPTools.Execute(oSql)
%>
<tr> </tr>
<%Do While NOT oRS.EOF%>
<tr>
<td>
<p><a href="menu.asp?ID=<%=oRS("MenuID")%>" class="menulink"><%=oRS("Menu")%></a> </p>
One thing you can do is this, set a page-level variable equal to whatever page you are on, then check it against the results from the recordset and change the display class in that instance.
For example, let's say you have a contact page, and it is called "Contact Us" in the database. At the top of that page, you could have this:
Dim strThisPage
strThisPage = "Contact Us"
Then, in your code to populate the menu:
<%Do While NOT oRS.EOF%>
<tr>
<td>
<p><a href="menu.asp?ID=<%=oRS("MenuID")%>"
<%If oRS("Menu") = strThisPage Then%>
class="menulinkhighlighted">
<%Else%>
class="menulink">
<%End If%>
<%=oRS("Menu")%></a> </p>
</td>
</tr>
<%Loop%>
-Moz