This topic is locked

Changing header based on form im working on

2/5/2010 8:40:49 PM
ASPRunnerPro General questions
M
Mwilson91325 author

I would like to change the Header based on page I am working on.

Let's say I was working on "Dispatch_Pass_On_Log_list.asp" then my header would be" Header1.asp"

Then Let's say I'm working on "Dispatch_Pass_On_Log_add.asp" then my header would be"Header2.asp"

Any ideas?

Sergey Kornilov admin 2/5/2010

Mark,
Request.ServerVariables("SCRIPT_NAME") gives you the current page URL.
So you can try to use the following in header.asp file:



<%
if Request.ServerVariables("SCRIPT_NAME")= "Dispatch_Pass_On_Log_list.asp" then

%>

<!-- #include file="header1.asp" -->

<%

end if
if Request.ServerVariables("SCRIPT_NAME")= "Dispatch_Pass_On_Log_add.asp" then

%>

<!-- #include file="header2.asp" -->

<%

end if
%>
M
Mwilson91325 author 2/6/2010

thanks but if no page = a script then can i have it default to lets say Header3.asp ?

Sergey Kornilov admin 2/7/2010

Yes, you can use the following statement

If ... Then

...

ElseIf ... then

...

ElseIf ... then

...

Else

...

End If


More info: http://www.w3schools.com/VBScript/vbscript_conditionals.asp