Odd behavior

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • anna

    #1

    Odd behavior

    I have a javascript that submits form to a new popup window. when the
    user is done with the popup, they close it by clicking on a button
    coded with window.close().

    function popup(url){
    var formObj = document.forms['frmMain'];
    window.open(url ,'frmNew','.... .');
    formObj.target= 'frmNew';
    formObj.method = "post";
    formObj.action = url;
    formObj.submit( );
    }

    A small window popups fine and closes fine. However, after the popup
    window is closed, any submitform from the original form (frmMain in
    this case) will open a new window instead of submit the form to the
    same window. wonder what the problem is and how to correct it?

    function submitform(url) {
    document.frmMai n.action = url;
    document.frmMai n.method = "post";
    document.frmMai n.submit();
    }

  • Lee

    #2
    Re: Odd behavior

    anna said:[color=blue]
    >
    >I have a javascript that submits form to a new popup window. when the
    >user is done with the popup, they close it by clicking on a button
    >coded with window.close().
    >
    >function popup(url){
    >var formObj = document.forms['frmMain'];
    >window.open(ur l,'frmNew','... ..');
    >formObj.target ='frmNew';
    >formObj.meth od = "post";
    >formObj.acti on = url;
    >formObj.submit ();
    >}
    >
    >A small window popups fine and closes fine. However, after the popup
    >window is closed, any submitform from the original form (frmMain in
    >this case) will open a new window instead of submit the form to the
    >same window. wonder what the problem is and how to correct it?
    >
    >function submitform(url) {
    >document.frmMa in.action = url;
    >document.frmMa in.method = "post";
    > document.frmMai n.submit();
    >}[/color]

    The problem is that you've set the target of frmMain to "frmNew".
    If you don't want that, set it back to "" or maybe "_self".

    Comment

    Working...