Connecting Tech Pros Worldwide Help | Site Map

Closing a window

  #1  
Old September 5th, 2008, 06:25 AM
Todd Cary
Guest
 
Posts: n/a
I create a new window with

onClick="openBrWindow(\'claimant_pdf.php\',\'\',\' toolbar=no,status=yes,scrollbars=no,resizable=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
  #2  
Old September 5th, 2008, 11:55 AM
GArlington
Guest
 
Posts: n/a

re: Closing a window


On Sep 5, 6:17*am, Todd Cary <t...@aristesoftware.comwrote:
Quote:
I create a new window with
>
onClick="openBrWindow(\'claimant_pdf.php\',\'\',\' toolbar=no,status=yes,scrollbars=no,resizable=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...
  #3  
Old September 5th, 2008, 03:05 PM
Nick S
Guest
 
Posts: n/a

re: Closing a window


On Sep 5, 7:17 am, Todd Cary <t...@aristesoftware.comwrote:
Quote:
I create a new window with
>
onClick="openBrWindow(\'claimant_pdf.php\',\'\',\' toolbar=no,status=yes,scrollbars=no,resizable=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(theWindow) you will be able to close the window if you
open it with

onClick="var theWindow = openBrWindow(\'claimant_pdf.php\',\'\',
\'toolbar=no,status=yes,scrollbars=no,resizable=no \')"

(I think) :) I've not tested it as I'm not at my PC :)
  #4  
Old September 5th, 2008, 07:45 PM
Todd Cary
Guest
 
Posts: n/a

re: Closing a window


GArlington wrote:
Quote:
On Sep 5, 6:17 am, Todd Cary <t...@aristesoftware.comwrote:
Quote:
>I create a new window with
>>
>onClick="openBrWindow(\'claimant_pdf.php\',\'\',\ 'toolbar=no,status=yes,scrollbars=no,resizable=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="openBrWindow(\'claimant_pdf.php\',\'Print Win\',\'toolbar=no,status=yes,scrollbars=no,resiza ble=no\')"

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

Many thanks
Todd
  #5  
Old September 6th, 2008, 12:05 AM
Nick S
Guest
 
Posts: n/a

re: Closing a window


On Sep 5, 8:43 pm, Todd Cary <t...@aristesoftware.comwrote:
Quote:
GArlington wrote:
Quote:
On Sep 5, 6:17 am, Todd Cary <t...@aristesoftware.comwrote:
Quote:
I create a new window with
>
Quote:
Quote:
onClick="openBrWindow(\'claimant_pdf.php\',\'\',\' toolbar=no,status=yes,scrollbars=no,resizable=no\' )"
>
Quote:
Quote:
as part of a submit button.
>
Quote:
Quote:
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()?
>
Quote:
Quote:
Many thanks...
>
Quote:
Quote:
Todd
>
Quote:
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="openBrWindow(\'claimant_pdf.php\',\'Print Win\',\'toolbar=no,status=yes,scrollbars=no,resiza ble=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?
  #6  
Old September 6th, 2008, 12:35 AM
Todd Cary
Guest
 
Posts: n/a

re: Closing a window


Nick S wrote:
Quote:
On Sep 5, 8:43 pm, Todd Cary <t...@aristesoftware.comwrote:
Quote:
>GArlington wrote:
Quote:
>>On Sep 5, 6:17 am, Todd Cary <t...@aristesoftware.comwrote:
>>>I create a new window with
>>>onClick="openBrWindow(\'claimant_pdf.php\',\'\' ,\'toolbar=no,status=yes,scrollbars=no,resizable=n o\')"
>>>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="openBrWindow(\'claimant_pdf.php\',\'Prin tWin\',\'toolbar=no,status=yes,scrollbars=no,resiz able=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
  #7  
Old September 6th, 2008, 12:05 PM
SAM
Guest
 
Posts: n/a

re: Closing a window


Todd Cary a écrit :
Quote:
Nick S wrote:
Quote:
>>
>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'>self.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
Quote:
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 ?
Quote:
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
};
Quote:
Usually the user closes the window....
setTimeout('self.close()', 2000);

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

--
sm
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing window and Clearing the session srinivas answers 1 June 2nd, 2006 11:25 PM
Closing window Sheldon Glickler answers 8 March 15th, 2006 10:05 PM
Detecting user closing window X Kiran answers 2 July 23rd, 2005 05:16 PM
Closing window not opened by the script - Netscape 7.1 Arun Seetharam answers 8 July 23rd, 2005 01:28 PM
javascript on closing window Daniel answers 3 July 23rd, 2005 11:27 AM