473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

page redirection

Hi all,

This will hopefully be a really simple question....

I'm a newbie at web app development, and am teaching my self as I go. I have
a page that requires a user to click a
button which then pops up a message box asking the user to make a choice.
Based on this choice, it will either redirect to another page or display a
message. I can get it to display a message, but when it tries to redirect I
get the error;

"Error: Object doesn't support this property or method: 'document.redirect'"

I have tried researching this error but cannot find a solution that works,
can anyone help?

The page code is as follows;

<form>
<INPUT TYPE="BUTTON" NAME="button_2" VALUE="Click Here!">

<SCRIPT LANGUAGE="VBScript" >
Sub button_2_onclick
answer=MsgBox ("Call Sheet", vbYesNoCancel, "Click Yes to create a call
sheet")
If answer = "6" then
document.write("answer = ")&answer
Else If answer = "7" Then
document.redirect="test2.html"
Else if answer = "2" then
exit sub
End If
End If
End If
End Sub
</SCRIPT>

</form>

Many thanks in advance

Paul

Jul 11 '08 #1
2 1879
Hi all,

sorry to waste your time, I have resolved it myself!!

Changed this line:-
document.redirect="test2.html"
To this:-
document.location.href="test2.html"

thanks again!

"Paul" <Pa**@here.localwrote in message
news:D2**********************************@microsof t.com...
Hi all,

This will hopefully be a really simple question....

I'm a newbie at web app development, and am teaching my self as I go. I
have a page that requires a user to click a
button which then pops up a message box asking the user to make a choice.
Based on this choice, it will either redirect to another page or display a
message. I can get it to display a message, but when it tries to redirect
I get the error;

"Error: Object doesn't support this property or method:
'document.redirect'"

I have tried researching this error but cannot find a solution that works,
can anyone help?

The page code is as follows;

<form>
<INPUT TYPE="BUTTON" NAME="button_2" VALUE="Click Here!">

<SCRIPT LANGUAGE="VBScript" >
Sub button_2_onclick
answer=MsgBox ("Call Sheet", vbYesNoCancel, "Click Yes to create a call
sheet")
If answer = "6" then
document.write("answer = ")&answer
Else If answer = "7" Then
document.redirect="test2.html"
Else if answer = "2" then
exit sub
End If
End If
End If
End Sub
</SCRIPT>

</form>

Many thanks in advance

Paul
Jul 11 '08 #2
Paul wrote:
Hi all,

sorry to waste your time, I have resolved it myself!!

Changed this line:-
document.redirect="test2.html"
To this:-
document.location.href="test2.html"
You should use window.location instead of document.location.
document.location is not part of any standard, while there is at least a
working draft that describes window.location:
http://www.w3.org/TR/Window/#location

See also:

"document.location was originally a read-only property, although Gecko
browsers allow you to assign to it as well. For cross-browser safety,
use window.location instead."

http://developer.mozilla.org/en/docs...ument.location

In any case, you can see for yourself that .redirect is not a method of
*any* DOM object:
http://msdn.microsoft.com/en-us/libr...53(VS.85).aspx


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jul 11 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Matt Adams | last post by:
A web page which exists for a couple of years under a certain address (e.g. http://www.aaa.com/bbb/ccc.html) is (should be) moved to another location (e.g....
0
by: itsharkopath | last post by:
Hi, Imagine a user in a hotspot, when he comes to the hotspot and tries to load a webpage (on the internet), he would automatically redirected to login page. I believe the following is to be...
0
by: James Wallace | last post by:
Is it possible to use forms authentication in the web.config file and FormsAuthentication.RedirectFromLoginPage with an asp page so that when the asp page is set to startup page on the project that...
4
by: Tim Marsden | last post by:
Hi, If I navigate from Page1 to Page2 then to Page3, using the response.redirect. When the user press the Back button, I what then to go to Page 1 and start again, not Page2. I dont want the...
6
by: MooreSmnith | last post by:
When I navigate to the next page using Response.Rediect("MyNextPage.aspx") current page Page_Load event is called. What I may wrongly understood is that post back will happen whenever there is any...
12
by: ACaunter | last post by:
Hi all, I was wondering how i could write some code which would automatically open the Login Page once the session has expired? -- AdamPC@hotmail.com
1
by: craigkenisston | last post by:
Hi, I recently read a lot about a topic called page hijacking. It seems that you can steal page rank from search engines while doing a redirect. I reminded I had a code in some pages, where...
2
by: Dr. Paul Caesar - CoullByte (UK) Limited | last post by:
Hi, I have created a Logout ASP.NET application using Forms Authentication. When a user logs out they get a confirmation page confirming logout and a button to click to return to the homepage....
10
by: Eric Lindsay | last post by:
This may be too far off topic, however I was looking at this page http://www.hixie.ch/advocacy/xhtml about XHTML problems by Ian Hickson. It is served as text/plain, according to Firefox...
6
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, We have two sites hosted on different servers and we have many pages on domain A which has many links(asp programs) to domain B. My question is if domain B server is in trouble, what is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.