VBScript redirect
Discussion
Hi everyone,
Ive done some searches, but am having trouble finding the answer to this.
At work we have some software which we use to create questionnaires. Because of the limited functionality this gives us, I have made a script using VBScript which generates a url. I need to redirect to this url, from the asp page it is on. I can use document.write fine, but when I use response.redirect I am told that an object is required. Ive not declared anything called response, so there are no clashes that I know of.
I read somewhere that it could be something to do with running this on the client/server or vice versa the wrong way round. I'm pretty new to this, so hopefully its something obvious! If anyone could shed some light on what is wrong, or a suitable alternative, that would be great.
Thanks in advance.
Ive done some searches, but am having trouble finding the answer to this.
At work we have some software which we use to create questionnaires. Because of the limited functionality this gives us, I have made a script using VBScript which generates a url. I need to redirect to this url, from the asp page it is on. I can use document.write fine, but when I use response.redirect I am told that an object is required. Ive not declared anything called response, so there are no clashes that I know of.
I read somewhere that it could be something to do with running this on the client/server or vice versa the wrong way round. I'm pretty new to this, so hopefully its something obvious! If anyone could shed some light on what is wrong, or a suitable alternative, that would be great.
Thanks in advance.
Are you redirecting to this URL from a button on the page or something? If so, then I think you may be a little confused between server side and client side scripting. The response objects are used for building up your page server side. i.e. Response.Write "Hello" would write hello to the page.
If you want to navigate to another page AFTER your asp page has been built (i.e. it has been displayed to the user) you need to embed the code to do the navigate into the page itself, so that it can be used client side.
Here is an example client side function that will navigate to a URL that you would pass to it. You could either embed this bit of script in the asp page in your designer, or use response.write to add this text to the page as you are building it.
<script language="VBScript" type="text/VBScript">
Function navigate_self(sURL)
me.navigate sURL
End Function
</script>
Your code behind the button (or combobox as the example below shows) would call this function with your URL. i.e.:
<% sURL = "whatever url"
sOnChange = "navigate_self " + sURL %>
<select name="cboSort" size="1" id="cboSort" onChange="<%=sOnChange%>">
Just in case you didnt know; the <% %> tags mean that code between the two tags is executed server side and will not appear in your generated page.
Hope that helps.
If you want to navigate to another page AFTER your asp page has been built (i.e. it has been displayed to the user) you need to embed the code to do the navigate into the page itself, so that it can be used client side.
Here is an example client side function that will navigate to a URL that you would pass to it. You could either embed this bit of script in the asp page in your designer, or use response.write to add this text to the page as you are building it.
<script language="VBScript" type="text/VBScript">
Function navigate_self(sURL)
me.navigate sURL
End Function
</script>
Your code behind the button (or combobox as the example below shows) would call this function with your URL. i.e.:
<% sURL = "whatever url"
sOnChange = "navigate_self " + sURL %>
<select name="cboSort" size="1" id="cboSort" onChange="<%=sOnChange%>">
Just in case you didnt know; the <% %> tags mean that code between the two tags is executed server side and will not appear in your generated page.
Hope that helps.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


