Home|Sitemap|Contact

How can you alter or not show links depending on which page was loaded using ASP?

The menu bar below should not show a link for this page, but should show a link for each of two related example pages.
ASP Conditional Menu Links 1 | ASP Conditional Menu Links 3

This page.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005, 2006 Roderick Divilbiss">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<title>ASP Conditional Menu Links</title>
</head>

<body>
<!--#include virtual="path/aspConditionalMenuLinksInclude.asp"-->
</body>

</html>

The included menu.
<%
' a variable to hold the currently loaded ASP page name.
Dim pageName

' get the page name from the server
pageName = Request.ServerVariables("SCRIPT_NAME")

' remove any preceding path
pageName = Mid(pageName, InStrRev(pageName,"/")+1)

' write a link only if it is NOT to this page.
if pageName <> "aspConditionalMenuLinks1.asp" then
    response.write "<a title=""ASP Conditional Menu Links Example Page 1"" " &_
    "href=""aspConditionalMenuLinks1.asp"">" &_
    "ASP Conditional Menu Links 1</a>&nbsp;|&nbsp;"
end if
if pageName <> "aspConditionalMenuLinks2.asp" then
    response.write "<a title=""ASP Conditional Menu Links Example Page 2"" " &_
    "href=""aspConditionalMenuLinks2.asp"">" &_
    "ASP Conditional Menu Links 2</a>&nbsp;|&nbsp;"
end if
if pageName <> "aspConditionalMenuLinks3.asp" then
    response.write "<a title=""ASP Conditional Menu Links Example Page 3"" " &_
    "href=""aspConditionalMenuLinks3.asp"">" &_
    "ASP Conditional Menu Links 3</a>"
end if
%>


Most Popular Pages On rodsdot.com

Client Side Includes Using JavaScript
Creating A JavaScript Slider Input in JavaScript
Creating Conditional Links With ASP
Dynamically Adding Rows and Fields To A Table Based Form
Geo-Coding IP Addresses
How To Make A Pop Over Menu
JavaScript Date Validation DD/MM/YYYY
JavaScript Date Validation MM/DD/YYYY
Parameterized SQL Using Multiple Form Inputs and Filtering
Play A WAV File On Mouseover
Pop Over Form
Resorting A Multi-Dimensional Table Using Client-Side JavaScript
Scripting Remote Images in JavaScript
Using AJAX to Return HTML For Dynamic Forms
Using Images For CAPTCHA
Using Parameterized SQL with ASP and MS Access
Why JavaScript As The HREF Of A Link Is Bad