Odd behavior

Discussion in 'Javascript' started by anna, Jan 14, 2005.

  1. anna

    anna Guest

    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.frmMain.action = url;
    document.frmMain.method = "post";
    document.frmMain.submit();
    }
     
    anna, Jan 14, 2005
    #1
    1. Advertising

  2. anna

    Lee Guest

    anna said:
    >
    >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.frmMain.action = url;
    >document.frmMain.method = "post";
    > document.frmMain.submit();
    >}


    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".
     
    Lee, Jan 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Elliot M. Rodriguez

    PLEASE HELP = odd TextChanged behavior

    Elliot M. Rodriguez, Oct 21, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    338
    Elliot M. Rodriguez
    Oct 22, 2003
  2. Guest

    Step-thru code - odd behavior

    Guest, May 28, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    397
    Guest
    Jun 1, 2004
  3. =?Utf-8?B?Q2hyaXM=?=
    Replies:
    1
    Views:
    349
    Karl Seguin
    Jan 7, 2005
  4. news.microsoft.com

    EXTREMELY odd cookie behavior

    news.microsoft.com, Mar 15, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    323
    Joerg Jooss
    Mar 15, 2005
  5. Michael Speer

    Odd behavior with odd code

    Michael Speer, Feb 16, 2007, in forum: C Programming
    Replies:
    33
    Views:
    1,155
    Richard Heathfield
    Feb 18, 2007
Loading...

Share This Page