M.O.S. Studios Posted January 15, 2009 Share Posted January 15, 2009 hey guys i want a window to close after the submit button has been hit any one know it? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 15, 2009 Share Posted January 15, 2009 window.close() but the window must be opened by window.open() or else it will prompt the user if they are sure they want to close it Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted January 15, 2009 Author Share Posted January 15, 2009 it didn't work this is my code <html> <head> <script type="text/javascript"> function sendToPageOne() { var thisValue = document.getElementById('image1').value; window.opener.form1.image1.value = thisValue; } </script> </head> <body> <form name="form2" onsubmit="window.close()";> <select name="image1" id="image1"> <option value="one">One</option> <option value="Two">Two</option> <option value="Three">Three</option> </select> </form> <input type="submit" onclick="sendToPageOne()"; value="Send to page 1"> </body> </html> it was opened with this code <br><a href="javascript:popUp('content/products/browse.php?name=image2')"><font size="1">Browse</font></a><input type="text" name="image2" value="" readonly> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 15, 2009 Share Posted January 15, 2009 sorry...it's just close() Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted January 15, 2009 Author Share Posted January 15, 2009 Hey still no luck i have tried self.close() close() and window.close() maybe im putting it in wrong this is what i did <form name="form2" onsubmit="self.close()"> Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 15, 2009 Share Posted January 15, 2009 try <html> <head> <script type="text/javascript"> function sendToPageOne() { var thisValue = document.getElementById('image1').value; window.opener.form1.image1.value = thisValue; close(); } </script> </head> <body> <select name="image1" id="image1"> <option value="one">One</option> <option value="Two">Two</option> <option value="Three">Three</option> </select> <input type="button" onclick="sendToPageOne()"; value="Send to page 1"> </body> </html> Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted January 15, 2009 Author Share Posted January 15, 2009 looking at what you did that would probably work aswell, how ever i just did this and it works perfectly <html> <head> <script type="text/javascript"> function sendToPageOne() { var thisValue = document.getElementById('<?php echo $_GET['name'] ?>').value; window.opener.form1.<?php echo $_GET['name'] ?>.value = thisValue; } </script> </head> <body> <form name="form2" action="browse.php" method="POST"> <select name="<?php echo $_GET['name'] ?>" id="<?php echo $_GET['name'] ?>"> <option value="one">One</option> <option value="Two">Two</option> <option value="Three">Three</option> </select> <input type="hidden" name="sent" value="1"> </form> <input type="submit" onclick="sendToPageOne();self.close();"; value="Send to page 1"> </body> </html> Quote Link to comment Share on other sites More sharing options...
M.O.S. Studios Posted January 15, 2009 Author Share Posted January 15, 2009 Thanks for all the help Quote Link to comment Share on other sites More sharing options...
shlumph Posted January 15, 2009 Share Posted January 15, 2009 What if they think it's a bug, and try and keep submiting the form, and say "God damnit, how come it keeps closing when I hit submit!!!"? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.