473,468 Members | 1,323 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Redirection problem

Hi

I have a piece of javascript that is generated like so...

strText += "<img style='cursor:hand' src='Resources/SurveyButtons/
Close.gif' onClick=javascript:window.open('ConfirmPage.aspx?
DisplayHeader=Yes&SurveyID=" + lngSurveyID + "','Results')>";
In the onclick event I want to close the current window then open
'ConfirmPage.aspx'. Whats the best way to do this? Can I close the
first
page then open the next, or should I be redirecting? If so whats the
best way to redirect using javascript?

Thanks

Oct 2 '07 #1
2 1415
Sems said the following on 10/2/2007 12:32 AM:
Hi

I have a piece of javascript that is generated like so...

strText += "<img style='cursor:hand' src='Resources/SurveyButtons/
Close.gif' onClick=javascript:window.open('ConfirmPage.aspx?
DisplayHeader=Yes&SurveyID=" + lngSurveyID + "','Results')>";
You can ditch the voodoo practice of javascript: in onclick event
handlers. It serves no purpose on the web. Second, give up opening new
windows, it is going to fail about as often as it succeeds. I know, your
boss wants it. Educate the "boss" and use a link to the page instead.
In the onclick event I want to close the current window then open
'ConfirmPage.aspx'.
If you didn't open the current window with script, you aren't going to
close it with script.
Whats the best way to do this?
The "best way" would be to stop trying to open/close windows and your
life gets a lot simpler.
Can I close the first page then open the next, or should I be redirecting?
As you can't close the first page, anything you do is better than trying
to. Just make it a link, let the user click it, open the next page in
the current window, and enjoy having a happy customer.
If so whats the best way to redirect using javascript?
Best way to redirect a web page from one page to the next?

<a href="nextPage.html">Bet this works even with JS disabled</a>
Thanks
Sure thing.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 2 '07 #2
On Oct 2, 5:42 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Sems said the following on 10/2/2007 12:32 AM:
Hi
I have a piece of javascript that is generated like so...
strText += "<img style='cursor:hand' src='Resources/SurveyButtons/
Close.gif' onClick=javascript:window.open('ConfirmPage.aspx?
DisplayHeader=Yes&SurveyID=" + lngSurveyID + "','Results')>";

You can ditch the voodoo practice of javascript: in onclick event
handlers. It serves no purpose on the web. Second, give up opening new
windows, it is going to fail about as often as it succeeds. I know, your
boss wants it. Educate the "boss" and use a link to the page instead.
In the onclick event I want to close the current window then open
'ConfirmPage.aspx'.

If you didn't open the current window with script, you aren't going to
close it with script.
Whats the best way to do this?

The "best way" would be to stop trying to open/close windows and your
life gets a lot simpler.
Can I close the first page then open the next, or should I be redirecting?

As you can't close the first page, anything you do is better than trying
to. Just make it a link, let the user click it, open the next page in
the current window, and enjoy having a happy customer.
If so whats the best way to redirect using javascript?

Best way to redirect a web page from one page to the next?

<a href="nextPage.html">Bet this works even with JS disabled</a>
Thanks

Sure thing.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices
This is part of a legacy system so changing it away from using
javascript is not an option sadly.

Any other ideas?

Oct 2 '07 #3

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

Similar topics

2
by: Rick N. Backer | last post by:
Hello folks, Novice type question here. I'm working with a very simple app here that takes a series of strings from the console. Once the end user has finished inputting the strings they are...
0
by: Dimitrios Mpougas | last post by:
Hello, I have two asp.net pages. The first is a page (main.aspx) wich has four links on it. The href value of each link is: href="view.aspx?id=1" traget="_blank" href="view.aspx?id=2"...
13
by: souissipro | last post by:
Hi, I have written a C program that does some of the functionalities mentionned in my previous topic posted some days ago. This shell should: 1- execute input commands from standard input,...
4
by: psual | last post by:
hi newbie in web design I got some issue concerning a secure redirection between 2 pages let say I have a page with a grid (the 'master' page) in this grid I can select a record, get its pk...
13
by: Massimo Fabbri | last post by:
Maybe it's a little OT, but I'll give it try anyway.... I was asked to maintain and further develop an already existing small company's web site. I know the golden rule of "eternal" URIs, but...
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:
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.