Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP programming

Status
Not open for further replies.

jimsterS

Programmer
Apr 24, 2001
71
0
0
US
I am building an ASP page so that when the user presses a button it take him to a different page. I am using the response.redirect("NewPage.asp") and am having trouble getting the syntax right. Here is what I have so far

<INPUT NAME=&quot;Button1&quot; TYPE=&quot;BUTTON&quot;
VALUE=&quot;Click Here&quot; Button1_onclick<%=Response.Redirect(&quot;NewPage.asp&quot;)%>

when I run the page it jumps to NewPage without giving the user a chance to push the button.

Any help would be appreciated.

Thanks
Jim Shepard
 
For future reference there is an ASP forum specifically for us ASP people, (they don't let us out much :p ) so you may want to join that one as well, always some interesting stuff being posted.

In regards to your question, since ASP is a server-side scripting language it gets executed before the page is sent to the client (browser) and then it is done. When you write a Response.Redirect into your ASP script it throws away what it had and immediately directs the browser to the new page. I believe what you want to do is something like this:
Code:
<input type=&quot;button&quot; onClick=&quot;document.location='NewPage.asp';&quot; Value=&quot;click here&quot;>
Pardon the javascript, but I generally write my ASP in VBScript and my clientside code in javascript to keep them seperate in my mind.

Hope that helps,
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
 
another option is to write a subroutine in your client side script

<script language=&quot;VBSCRIPT&quot;>
sub button1_onclick()
form1.action = &quot;NewPage.asp&quot;
form1.submit()
end sub
</script>

this subroutine is triggered when u click the button named button1 with in the form tag named form1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top