atl_andy Posted December 6, 2007 Share Posted December 6, 2007 A simple form to select a project and enter a user id that opens in a new window. Now: once the user enters the desired project and clicks "Enter Assets", the audit form is opened in frame2. Goal: How do I get the audit form to open back in the parent window? (I'm following an example from a book, but want to get the concept down to add to a web app) Parent window: <html> <head> <title>Page Testing</title> <link href="style.css" type="text/css" rel="stylesheet" /> <script type="text/javascript"> function blankFrame() { return "<html><body></body></html>"; } var newWind; function openCenteredWindow(url) { var width = 200; var height = 200; var left = parseInt((screen.availWidth/3) - (width/3)); var top = parseInt((screen.availHeight/3) - (height/3)); var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top; newWind = window.open("select-project.html", "subWind", windowFeatures); } </script> </head> <ul> <li><a href="" onclick="openCenteredWindow()">Enter New Project</a></li> </ul> </html> The pop-up window: <html> <head> <title>Select Project</title> <link href="style.css" type="text/css" rel="stylesheet" /> </head> <body> <p>Select Project:<input type="text" name="projectnumber" size="20" maxlength="40" value="" /></p> <p>Select User Name:<input type="text" name="userid" size="20" maxlength="40" value="" /></p> <a href="audit.html" target="frame2">Enter Assets</a> </body> </html> Link to comment https://forums.phpfreaks.com/topic/80387-pop-up-window-openclose-new-to-js/ Share on other sites More sharing options...
atl_andy Posted December 6, 2007 Author Share Posted December 6, 2007 ...and close the pop-up window. Link to comment https://forums.phpfreaks.com/topic/80387-pop-up-window-openclose-new-to-js/#findComment-407586 Share on other sites More sharing options...
phpQuestioner Posted December 6, 2007 Share Posted December 6, 2007 are you wanting to re-display the form in the pop-up window; back in your parent window or are you wanting the form results or are you wanting to submit the form and destroy the pop-up? If your wanting to submit the form and destroy the pop-up: target the parent window and use window.close() onsubmit. Link to comment https://forums.phpfreaks.com/topic/80387-pop-up-window-openclose-new-to-js/#findComment-407757 Share on other sites More sharing options...
nogray Posted December 6, 2007 Share Posted December 6, 2007 window.opener is the parent window for pop-up window.close() wil close the pop-up window Link to comment https://forums.phpfreaks.com/topic/80387-pop-up-window-openclose-new-to-js/#findComment-408367 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.