Forum Moderators: phranque
<a href='#' onClick='go("products.asp");return false;'>Products</a>
I want to use multiples of it as menu choices, no problem there.
But each choice as yet only takes you to a page. I want it to choose the same page but have a variable set so that the asp code on the page can tell which choice it was.
It is part of a simple shopping cart and leaving the page causes the cart to reset (another thing I have to look at).
I have used a form and it works as far as the variable but the cart resets to no product.
Also, my old html book does not mention onclick. What version of code is this command and where can I find good online references to it?
Hope there is enough here to go by.
thanks for your efforts.
You want all requests to go to the same asp page that will change depending on what the request was for.
Is this correct?
If so, you can set up the ASP page to look for the variable (i think you already knew that). And for the menu items you should be able to get away with something like this:
<a href='#' onClick='go("mainpage.asp?page=products");return false;'>Products</a>
HTH
this is the head.asp file
<p>[ <a href='#'
onClick='go("/index.asp");return false;'>Home</a> ¦ <a href='#'
onClick='go("products.asp?choose=bulbs");return false;'>bulbs</a> ¦ <a href='#'
onClick='go("products.asp?choose=wipers");return false;'>wipers</a> ¦ <a href='#'
onClick='go("products.asp?choose=oil");return false;'>oil</a> ¦ <a href='#'
onClick='go("cart.asp");return false;'>Show Cart</a> ]
this is the products asp file:
<!--#include file='db.asp'-->
<!--#include file='head.asp'-->
*** notice the link to head.asp which shows this menu on the products page
<title>Auto Supplies</title>
<table border=0 width=500 cellpadding=0 cellspacing=0>
<%
' Value of text input field "choose"
myquery = Request.Form("choose")
myquery = "exec q"
if myquery = "exec q" then myquery = "exec qlistall"
' executing stored procedure
set rs = conn.execute(myquery)
do while not rs.eof
*** end of file
As you can see I need to get the value of 'choose' into the asp code. I may be missing the obvious, who knows.
Any help is welcomed.
select case myquerycase 1
do thing a
case 2
do thing b
case 3
do thing c
case else
do something differentend select
It takes the the place of the multiple if statments and is a little easier to read than "ifelse" statements. If this doesn't help you may want to try the ASP Forum.