Re: onunload
- From: "John" <Please.dont@xxxxxxxxxxxxxxxx>
- Date: Sun, 22 May 2005 11:41:28 -0400
"Angel" <Angel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:23C9D2E1-188D-4F8F-800D-B5C117ED4FB3@xxxxxxxxxxxxxxxx
>I am trying to capture when the user clicks the X button on the ie window.
>I
> have used the onunload for the window event, but there is a problem. I put
> javascript code for this event and when the form performs a postback on
> the
> page, the onunload event gets triggered eventhough I am still on the same
> page and the user did not click the 'X' button. In other words, the
> onunload
> event is triggered when you are performing a postback to the page. Is
> there
> anyway around this? I want to capture when the user clicks the 'X' and not
> when the page is performing a postback...
>
If you are only using this for the X button, why not put the script in the X
buttons onclick event?
If you need if for other times, leave the functionality in the unload event,
and set a flag in the X button onclick event.
Also, be aware that if the form has validation and validation fails, you may
still be looking at a problem. I have managed to overcome the clientside
validation of the asp.net validation controls by using the following in the
onclick event :
if("none" != valSummary.style.display)
{
// perform my unload functionality.
}
Good luck,
John MacIntyre
http://www.johnmacintyre.ca
Specializing in; Database, Web-Applications, and Windows Software
.
- References:
- onunload
- From: Angel
- onunload
- Prev by Date: Re: Hyperlink in SMTPMail
- Next by Date: Thread was being aborted
- Previous by thread: onunload
- Next by thread: table disappears!
- Index(es):
Loading