Accessing href attribute for menu system?

R

Robert Mark Bram

Hi All!

I have a menu system on my asp pages that use tables with a bunch of cells
like this:
<td class="menuHeader"><a href="../default.asp">Home</a></td>
<td class="menuEntry"><a href="../blog/default.asp">Blog!</a></td>
<td class="menuEntry"><a href="linkOMatic/default.asp">Link-O-Matic</a></td>

Now I want a system where one of the cells has a different class if that
page is being viewed. So, if default.asp is being viewed, that cell would
be:
<td class="classy"><a href="../default.asp">Home</a></td>

My question is how to do this. I have two ideas.

1)
Each page has an id..
<% var pageId=33; %>

<td class="<%=(pageId=33?"classy":"menuHeader")%>"><a
href="../default.asp">Home</a></td>

I know this one will work ok, but it is clumsy - I will have to handcode
each menu item and give each page a pageId just to implement this.

2)
This is what I was thinking of instead:
<td class="<%=(Request.ServerVariables("SCRIPT_NAME")==THIS
HREF?"classy":"menuHeader")%>"><a href="../default.asp">Home</a></td>
Is there a way to write ASP that can access the HREFF attribute of the
anchor tag in this way? If I could do this, I would not need to hand code
anything - all the changes could be made with a find-replace.

Thanks for any advice!

Rob
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,142
Latest member
arinsharma
Top