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/