#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Location
    Boston
    Posts
    261
    Rep Power
    17

    using pop up windows and target


    I am using pop up windows that have forms that submit back to the parent window. So my form tag in the pop up looks like this:

    form method="post" action="page.php" target="opener" onSuubmit="window.close()"

    the javascript to pop a new window is:

    var aWindow = null;
    function openWin(URL, w, h){
    aWindow = open(URL,'aWindow','width='+w+',height='+h+',scrollbars=yes, status=yes');
    if(aWindow.opener == null) aWindow.opener = window;
    aWindow.opener.name="opener";
    }

    this works fine in Internet Explorer, when I submit the form from the pop up it closes the window and reloads the parent page according to the form action. In Netscape 7 it simply closes the pop up, but doesn't reload the parent window.

    Any ideas why Netscape isn't executing the target argument?
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    20
    Might try this:

    var aWindow = null;
    self.name = 'mainWin';
    function openWin(URL, w, h){
    aWindow = open(URL,'aWindow','width='+w+',height='+h+',scrollbars=yes, status=yes');
    }

    <form .......target="mainWin"..........>

    Could be a conflict with the use of 'opener' as a window name.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Location
    Boston
    Posts
    261
    Rep Power
    17
    tried "mainWin", still doesn't work in NS
  6. #4
  7. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    20
    Sorry, wasn't giving this full attention. Form.onsubmit is called before the form is actually submitted; bad time to close the window the form is in.

    <form method="post" ................
    onSubmit="setTimeout('self.close()',1000)">

    I'm sure there's a more elegant way of doing this, but see if that works; maybe someone has something better (I'll be thinking about it).
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Location
    Boston
    Posts
    261
    Rep Power
    17
    ok, so that worked, although NS 7 pops this window asking if you want it to remember the values from the form, and if you don't get to it in time, the changes don't take... rrrggghhh just when I think Netscape might be an ok browser after all....
  10. #6
  11. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    20
    Don't have NS7 here at the moment...try:

    <input type="button" value="Submit" onclick="this.form.submit();self.close()">

    ...in place of the submit button, and lose the onsubmit handler.

IMN logo majestic logo threadwatch logo seochat tools logo