I am mixing ASP/VBScript with client-side Javascript, and part of it works,
and part does not. But both parts are coded practically the same, so I don't
see what I am doing wrong.
First, I do some ASP to get my page name and put it into an ASP variable
called strPageName. I verified that this part is working correctly, by doing
a response.write of strPageName.
Next, I needed to populate a couple of Javascript variables:
<script type='text/javascript'>
var strPageName = "<%=strPageName %>";
var strTicketID = "<%=strTicketID %>";
</script>
So then, I should point out that I have some javascript code which builds a
menu. Very good code when it's static, but I'm trying to make it dynamic.
If I am on one of two pages, I want it to show 5 main menu items. Otherwise,
just 4 of them. Here's where it's breaking. I only see 4 menu items, even
when it's on the pages in question. I tried it on several pages, and it
shows up exactly the same no matter what. And no error messages as far as I
can tell.
Here's the code to make that 5th menu item, as well as its submenu items,
show up:
=============== ==============
//above this is the part that builds the first 3 main items
Menu4=new Array("ARGOMEDI A","http://argomedia","",0 );
if (strPageName == "DisplayFullTic ketInfo.asp")
{
Menu4=new Array("This Ticket","","",6 );
Menu4_1=new Array("Add To This
Ticket","AddToT icket.asp?Ticke tID="+strTicket ID,"",0,20,150) ;
Menu4_2=new Array("Edit This
Ticket","Ticket Log.asp?TicketI D="+strTicketID +"&New=notnew", "",0);
Menu4_3=new Array("Go To Latest History
Item","DisplayF ullTicketInfo.a sp?TicketID="+s trTicketID+"#la test","",0);
Menu4_4=new Array("Printabl e--All
notes","Display FullTicketInfo. asp?Print=Yes&T icketID="+strTi cketID,"",0);
Menu4_5=new Array("Printabl e--No Internal
notes","Display FullTicketInfo. asp?Print=Yes&T icketID="+strTi cketID+"&Intern a
l=no","",0);
Menu4_6=new Array("Printabl e--No External
notes","Display FullTicketInfo. asp?Print=Yes&T icketID="+strTi cketID+"&Extern a
l=no","",0);
Menu5=new Array("ARGOMEDI A","http://argomedia","",0 );
}
if (strPageName == "AddToTicket.as p")
{
Menu4=new Array("This Ticket","","",2 );
Menu4_1=new Array("Edit This
Ticket","Ticket Log.asp?TicketI D="+strTicketID +"&New=notnew", "",0);
Menu4_2=new
Array("Bottom", "AddToTicket.as p?TicketID="+st rTicketID+"#lat est","",0);
Menu5=new Array("ARGOMEDI A","http://argomedia","",0 );
}
=============== ==============
So the problem is that the IF statement doesn't seem to take. In other
words, it acts like it's not on AddToTicket.asp or
DisplayFullTick etInfo.asp, when it clearly is.
I am sure I have a minor syntax problem, so if anyone can spot my error, I
would appreciate it.
I should also add that this is for an Intranet app, and all users are on IE
5 or higher
and part does not. But both parts are coded practically the same, so I don't
see what I am doing wrong.
First, I do some ASP to get my page name and put it into an ASP variable
called strPageName. I verified that this part is working correctly, by doing
a response.write of strPageName.
Next, I needed to populate a couple of Javascript variables:
<script type='text/javascript'>
var strPageName = "<%=strPageName %>";
var strTicketID = "<%=strTicketID %>";
</script>
So then, I should point out that I have some javascript code which builds a
menu. Very good code when it's static, but I'm trying to make it dynamic.
If I am on one of two pages, I want it to show 5 main menu items. Otherwise,
just 4 of them. Here's where it's breaking. I only see 4 menu items, even
when it's on the pages in question. I tried it on several pages, and it
shows up exactly the same no matter what. And no error messages as far as I
can tell.
Here's the code to make that 5th menu item, as well as its submenu items,
show up:
=============== ==============
//above this is the part that builds the first 3 main items
Menu4=new Array("ARGOMEDI A","http://argomedia","",0 );
if (strPageName == "DisplayFullTic ketInfo.asp")
{
Menu4=new Array("This Ticket","","",6 );
Menu4_1=new Array("Add To This
Ticket","AddToT icket.asp?Ticke tID="+strTicket ID,"",0,20,150) ;
Menu4_2=new Array("Edit This
Ticket","Ticket Log.asp?TicketI D="+strTicketID +"&New=notnew", "",0);
Menu4_3=new Array("Go To Latest History
Item","DisplayF ullTicketInfo.a sp?TicketID="+s trTicketID+"#la test","",0);
Menu4_4=new Array("Printabl e--All
notes","Display FullTicketInfo. asp?Print=Yes&T icketID="+strTi cketID,"",0);
Menu4_5=new Array("Printabl e--No Internal
notes","Display FullTicketInfo. asp?Print=Yes&T icketID="+strTi cketID+"&Intern a
l=no","",0);
Menu4_6=new Array("Printabl e--No External
notes","Display FullTicketInfo. asp?Print=Yes&T icketID="+strTi cketID+"&Extern a
l=no","",0);
Menu5=new Array("ARGOMEDI A","http://argomedia","",0 );
}
if (strPageName == "AddToTicket.as p")
{
Menu4=new Array("This Ticket","","",2 );
Menu4_1=new Array("Edit This
Ticket","Ticket Log.asp?TicketI D="+strTicketID +"&New=notnew", "",0);
Menu4_2=new
Array("Bottom", "AddToTicket.as p?TicketID="+st rTicketID+"#lat est","",0);
Menu5=new Array("ARGOMEDI A","http://argomedia","",0 );
}
=============== ==============
So the problem is that the IF statement doesn't seem to take. In other
words, it acts like it's not on AddToTicket.asp or
DisplayFullTick etInfo.asp, when it clearly is.
I am sure I have a minor syntax problem, so if anyone can spot my error, I
would appreciate it.
I should also add that this is for an Intranet app, and all users are on IE
5 or higher
Comment