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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use redirect in a function

Status
Not open for further replies.

streborr

IS-IT--Management
Jan 16, 2002
98
How do I use redirect in a function?
This is what I have, but doesn't work.

<Script Language=&quot;VBScript&quot;>
Sub WhatButton(intIndex)
Select Case intIndex
Case 1
response.redirect &quot;deleteRec.asp?id =rsADO(&quot;vw_ID&quot;)&quot;
Case 2
response.redirect &quot;records.asp&quot;
End Select
End Sub
</script>

<input name=&quot;del_yes&quot; type=&quot;button&quot; value=&quot;Yes&quot; OnClick=&quot;WhatButton(1)&quot;>
<input name=&quot;del_no&quot; type=&quot;button&quot; value=&quot;No&quot; OnClick=&quot;WhatButton(2)&quot;>

Thanks for any help,
Rick
 
response.redirect is a server side method. It can not be run from the client side.

If you want to do this on the client try this ( assuming the rsADO is on run on the client side)


<Script Language=&quot;VBScript&quot;>
Sub WhatButton(intIndex)
Select Case intIndex
Case 1
window.location= &quot;deleteRec.asp?id =&quot; & rsADO(&quot;vw_ID&quot;)
Case 2
window.location= &quot;records.asp&quot;
End Select
End Sub
</script>
 
There is another thing to remember when using the response.redirect option just for future reference.

It only works prior to any HTML headers being written to the page. This means that after you have written anything that the client will see, not just variables and server actions, you can't use the redirect command anymore.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top