Jump to content

Pop-up window open/close (new to js)


atl_andy

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.