Closing a window

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

    Closing a window

    I create a new window with

    onClick="openBr Window(\'claima nt_pdf.php\',\' \',\'toolbar=no ,status=yes,scr ollbars=no,resi zable=no\')"

    as part of a submit button.

    Now I would like to close the window in my php code if a line is
    executed e.g. an echo statement. What syntax do I use to execute
    window.close()?

    Many thanks...

    Todd
  • GArlington

    #2
    Re: Closing a window

    On Sep 5, 6:17 am, Todd Cary <t...@aristesof tware.comwrote:
    I create a new window with
    >
    onClick="openBr Window(\'claima nt_pdf.php\',\' \',\'toolbar=no ,status=yes,scr ollbars=no,resi zable=no\')"
    >
    as part of a submit button.
    >
    Now I would like to close the window in my php code if a line is
    executed e.g. an echo statement.  What syntax do I use to execute
      window.close()?
    >
    Many thanks...
    >
    Todd
    You can NOT close the window in your PHP code because... Please think
    about it yourself...
    You can close the window in Javascript if you know window's name - the
    second parameter in your window.open code that is currently empty -
    give it some name (preferably unique, but repeatable - so do NOT use
    UUID) and use that name to address and close the window...

    Comment

    • Nick S

      #3
      Re: Closing a window

      On Sep 5, 7:17 am, Todd Cary <t...@aristesof tware.comwrote:
      I create a new window with
      >
      onClick="openBr Window(\'claima nt_pdf.php\',\' \',\'toolbar=no ,status=yes,scr ollbars=no,resi zable=no\')"
      >
      as part of a submit button.
      >
      Now I would like to close the window in my php code if a line is
      executed e.g. an echo statement. What syntax do I use to execute
      window.close()?
      >
      Many thanks...
      >
      Todd
      While Garlington is correct in a very literal sense, if you echo out
      window.close(th eWindow) you will be able to close the window if you
      open it with

      onClick="var theWindow = openBrWindow(\' claimant_pdf.ph p\',\'\',
      \'toolbar=no,st atus=yes,scroll bars=no,resizab le=no\')"

      (I think) :) I've not tested it as I'm not at my PC :)

      Comment

      • Todd Cary

        #4
        Re: Closing a window

        GArlington wrote:
        On Sep 5, 6:17 am, Todd Cary <t...@aristesof tware.comwrote:
        >I create a new window with
        >>
        >onClick="openB rWindow(\'claim ant_pdf.php\',\ '\',\'toolbar=n o,status=yes,sc rollbars=no,res izable=no\')"
        >>
        >as part of a submit button.
        >>
        >Now I would like to close the window in my php code if a line is
        >executed e.g. an echo statement. What syntax do I use to execute
        > window.close()?
        >>
        >Many thanks...
        >>
        >Todd
        >
        You can NOT close the window in your PHP code because... Please think
        about it yourself...
        You can close the window in Javascript if you know window's name - the
        second parameter in your window.open code that is currently empty -
        give it some name (preferably unique, but repeatable - so do NOT use
        UUID) and use that name to address and close the window...
        Point well taken. So if I had

        onClick="openBr Window(\'claima nt_pdf.php\',\' PrintWin\',\'to olbar=no,status =yes,scrollbars =no,resizable=n o\')"

        what would the syntax be to PrintWin.close( )? What would I echo
        to execute the JavaScript?

        Many thanks
        Todd

        Comment

        • Nick S

          #5
          Re: Closing a window

          On Sep 5, 8:43 pm, Todd Cary <t...@aristesof tware.comwrote:
          GArlington wrote:
          On Sep 5, 6:17 am, Todd Cary <t...@aristesof tware.comwrote:
          I create a new window with
          >
          onClick="openBr Window(\'claima nt_pdf.php\',\' \',\'toolbar=no ,status=yes,scr ollbars=no,resi zable=no\')"
          >
          as part of a submit button.
          >
          Now I would like to close the window in my php code if a line is
          executed e.g. an echo statement. What syntax do I use to execute
          window.close()?
          >
          Many thanks...
          >
          Todd
          >
          You can NOT close the window in your PHP code because... Please think
          about it yourself...
          You can close the window in Javascript if you know window's name - the
          second parameter in your window.open code that is currently empty -
          give it some name (preferably unique, but repeatable - so do NOT use
          UUID) and use that name to address and close the window...
          >
          Point well taken. So if I had
          >
          onClick="openBr Window(\'claima nt_pdf.php\',\' PrintWin\',\'to olbar=no,status =yes,scrollbars =no,resizable=n o\')"
          >
          what would the syntax be to PrintWin.close( )? What would I echo
          to execute the JavaScript?
          >
          Many thanks
          Todd
          Is the code that closes the window going to be in the opened window or
          the calling window?

          Comment

          • Todd Cary

            #6
            Re: Closing a window

            Nick S wrote:
            On Sep 5, 8:43 pm, Todd Cary <t...@aristesof tware.comwrote:
            >GArlington wrote:
            >>On Sep 5, 6:17 am, Todd Cary <t...@aristesof tware.comwrote:
            >>>I create a new window with
            >>>onClick="ope nBrWindow(\'cla imant_pdf.php\' ,\'\',\'toolbar =no,status=yes, scrollbars=no,r esizable=no\')"
            >>>as part of a submit button.
            >>>Now I would like to close the window in my php code if a line is
            >>>executed e.g. an echo statement. What syntax do I use to execute
            >>> window.close()?
            >>>Many thanks...
            >>>Todd
            >>You can NOT close the window in your PHP code because... Please think
            >>about it yourself...
            >>You can close the window in Javascript if you know window's name - the
            >>second parameter in your window.open code that is currently empty -
            >>give it some name (preferably unique, but repeatable - so do NOT use
            >>UUID) and use that name to address and close the window...
            >Point well taken. So if I had
            >>
            >onClick="openB rWindow(\'claim ant_pdf.php\',\ 'PrintWin\',\'t oolbar=no,statu s=yes,scrollbar s=no,resizable= no\')"
            >>
            >what would the syntax be to PrintWin.close( )? What would I echo
            >to execute the JavaScript?
            >>
            >Many thanks
            >Todd
            >
            Is the code that closes the window going to be in the opened window or
            the calling window?
            It will be in the Opened Window. If an error is created, the
            code takes the user to the error window, so now it is leaving
            behind an opened window.

            Usually the user closes the window....

            Todd

            Comment

            • SAM

              #7
              Re: Closing a window

              Todd Cary a écrit :
              Nick S wrote:
              >>
              >Is the code that closes the window going to be in the opened window or
              >the calling window?
              >
              It will be in the Opened Window.
              So, no difficulty :

              <?php
              if(error) {
              echo "<script type='text/javascript'>sel f.close();</script>";
              }
              ?>

              No importance if a new page has been opened in the same popup,
              this popup yet knows it has been opened by Javascript and will accept to
              be closed by JS
              If an error is created, the code takes the user to the error window,
              You mean your popup open a new one more ?

              If it is to close the precedent popup why not to open the error's page
              in same popup ?
              so now it is leaving behind an opened window.
              in the daughter of the daughter, to close hers mother :

              window.onload = function() {
              var ancestor = opener.opener;
              opener.close();
              opener = ancestor; // the grand mother
              };
              Usually the user closes the window....
              setTimeout('sel f.close()', 2000);

              <body onblur="self.cl ose();">
              (probably not well working with IE)

              --
              sm

              Comment

              Working...