Hepolite Posted July 18, 2007 Author Share Posted July 18, 2007 I tried that, it didn't work... Maybe I did some mistake when I added some more code. <script type="text/javascript">function verifyAnswer(){if(confirm("Are you sure?")){ return true;}else{ return false;}}function open_win(){ // only run the window.open code if the verifyAnswer // function returns true. if(verifyAnswer()) {var win = window.open("http://page1.html");win.onUnload = function(){ var win2 = window.open("http://page2.html"); win2.onUnload = function() { var win3 = window.open("http://page3.html"); win3.onUnload = function() { var win4 = window.open("http://page4.html"); win4.onUnload = function() { var win5 = window.open("http://page5.html"); } } }} }}</script><input type="submit" value="Somevalue" name="gwar" onclick="open_win()" /> This works, but it open only one page, and it doesn't close... Nothing happens after the first window open Link to comment Share on other sites More sharing options...
Hepolite Posted July 24, 2007 Author Share Posted July 24, 2007 Anyone who can help me? Link to comment Share on other sites More sharing options...
Synook Posted July 25, 2007 Share Posted July 25, 2007 "http://page1.html" is not a valid address... but otherwise it looks ok Link to comment Share on other sites More sharing options...
Hepolite Posted July 25, 2007 Author Share Posted July 25, 2007 "http://page1.html" is not a valid address... but otherwise it looks ok That's just for adding an adress, and an example. That url can be anything, like http://something.com <-- that's something Link to comment Share on other sites More sharing options...
Synook Posted July 27, 2007 Share Posted July 27, 2007 Oh right I think I get what you want - you want an automatic timeout that makes the first window close and the next window open... <script type="text/javascript">function verifyAnswer(){if(confirm("Are you sure?")){ return true;}else{ return false;}}function open_win(){ // only run the window.open code if the verifyAnswer // function returns true. if(verifyAnswer()) {viewTime = 5000; //Set the view time to 5000 msvar win = window.open("http://page1.html");setTimeout("win.close()", viewTime);win.onUnload = function(){ var win2 = window.open("http://page2.html"); setTimeout("win2.close()", viewTime); win2.onUnload = function() { var win3 = window.open("http://page3.html"); setTimeout("win3.close()", viewTime); win3.onUnload = function() { var win4 = window.open("http://page4.html"); setTimeout("win4.close()", viewTime); win4.onUnload = function() { var win5 = window.open("http://page5.html"); setTimeout("win5.close()", viewTime); } } }} }}</script><input type="submit" value="Somevalue" name="gwar" onclick="open_win()" /> Link to comment Share on other sites More sharing options...
Hepolite Posted July 27, 2007 Author Share Posted July 27, 2007 Not exactly an automatic timeout, but it would work. But that's what I want. Still, that code doesn't do anything else than open the first page...If it looks ok, why can't I make it work? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 28, 2007 Share Posted July 28, 2007 Browsers just don't have support for what you want to do. It does look like it should work, but something happens with the DOM when a new page opens that causes this approach not to work. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.