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

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