Page 1 of 1
Help with redirect
Posted: Fri Apr 20, 2007 2:24 pm
by l9pt5
I need some suggestion about redirecting a page. I've a php script that when a user choose an option from a drop down menu, a javascript open a new page at that moment for the user to input something, once it's done the user can click on the Close button to close this window. After that, I want the php script to redirect to some place (e.g.
http://myplace.com) instead of remain at the drop down menu. Could someone tell me how to do this. Thanks...
Posted: Fri Apr 20, 2007 3:12 pm
by PhpMachine
This is easily done with JS.
For instance:
Code: Select all
document.location.href = "http://myplace.com";
or
Code: Select all
window.location.href = "http://myplace.com"
Posted: Fri Apr 20, 2007 3:20 pm
by l9pt5
Could you tell me where do I place this code?
Posted: Fri Apr 20, 2007 3:28 pm
by PhpMachine
One mistake of mine.
You do this in the opened window, not the opener window...
On the close button, set the following to the "onclick" attribute of the button:
Code: Select all
opener.location.href="http://myplace.com";
Posted: Fri Apr 20, 2007 5:11 pm
by l9pt5
Ok, I tried with the following, but it's not working. Am I missing something?
Code: Select all
<input style="color: #A52A2A" type=submit value="Close Window" onclick="javascript:window.location = 'http://www.yahoo.com';">
Posted: Fri Apr 20, 2007 6:06 pm
by John Cartwright
Code: Select all
<input style="color: #A52A2A" type="submit" onClick="location.href='http://yahoo.com'">
Works for me