Hi All,
Thanks for the Tips.
Regards
Mangesh
----- Original Message -----
From: Robert Nyman
To: javascript
Sent: Thursday, February 13, 2003 3:39 PM
Subject: [javascript] Re: Closing the browser window
Good thinking, Scott!
You apparently did think it through more than I did... :-)
/Robert
-----Original Message-----
From: Scott.Thomas@g... [mailto:Scott.Thomas@g...]
Sent: den 13 februari 2003 09:54
To: javascript
Subject: [javascript] Re: Closing the browser window
You can determine of the X has been pressed to close the window by
checking a few properties.
var iKey = window.event.keyCode
var iX = window.document.body.offsetWidth - window.event.clientX var iY
= window.event.clientY
iKey will tell you if the enter key or has been pressed.
If iTest is <=20 than the mouse must have been within 20 pixels of the
right hand side of the browser.
If iY is negative then the mouse must be outside the webpage IE over a
toolbar or menu item etc.
By checking these properties in the onbeforeunload, you should be able
to
safely determine:
Someone has entered an address into the address bar. The enter key
has
been pressed.
Someone pressed the back button. iX is
gretaer than 20 and iY is negative.
Someone pressed the X Button. iX is <=20 and
iY
is negative.
Theres a lot you can do to regarding screen measurements.
Search for Measuring Element Dimension and Location on MSDN for more
info.
Scott Thomas
Developer Gala Leisure
_____________________________________________________________________
This message and any attachments are confidential and should only be
read by the intended recipient. If you are not the intended recipient,
please inform us by replying to this message, delete the message from
your computer and destroy any copies. Any distribution or copying
without prior permission is prohibited.
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service.
Registered Office: Gala Group Limited, New Castle House, Castle
Boulevard, Nottingham, NG7 1FT. Registered in England no. 3927901