On Mar 15, 4:19 pm, "Rabel" <R...@Creativeness.comwrote:
Hi I am a novice with both asp and javascript so I may not even be
doing this correctly, but I have an asp page that has variable being
passed to it and I have a button that I need to have it go to one page
if it is one variable and another if it was the other variable. There
is only two choices but my attempts didnt work. Any direction or help
is really appreciated.
Thanks,
Randy
The trick is to remember that your ASP code and your Javascript
execute at entirely different times and on different machines. Your
ASP code is building your javascript code, but plays no parts in it's
execution, that happens later on the client.
It would be a lot easier if I knew what values your ASP variable could
contain and what was actually supposed to happen in each case.
But...let's assume that your ASP variable contains one of two possible
values: "Customer" and "Vendor"...
Customers go to
http://website/customers/login.html and vendors go to
http://website/vendors/login.html.
I'm not an ASP developer, but a JSP developer. However they're close
enough you can probably piece it together from here:
<%
//Obtain our request parameter and assign it to 'route'
String route = request.getParameter("route");
%>
<input type="button" value="Login" onclick="document.location.href='<
%= route.equalsIgnoreCase("customer") ? "/customers/login.html" : "/
vendors/login.html" %>';"/>
HTH...