Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: events


Message #1 by "marc cardenas" <marclena@h...> on Tue, 11 Feb 2003 10:59:49
Tha's how the onUnload event works,
it gets called every time the the page unloads.

What you can do, for instance, is to set some variable when you click a
link,
so it doesn't execute all the code in the onUnload event handler.

For example:

var bLinkClicked =3D false;
function unloadFunc(){
	if(!bLinkClicked){
		// Execute unload script here
	}
}

<body onunload=3D"unloadFunc()">

<a href=3D"http://p2p.wrox.com" onClick=3D"bLinkClicked=3Dtrue">Link</a>

Not sure if it will work with onClick on the link,
but in that case, change it for onMosueDown or something similar.


/Robert


-----Original Message-----
From: marc cardenas [mailto:marclena@h...]
Sent: den 11 februari 2003 12:36
To: JavaScript HowTo
Subject: [javascript_howto] RE: events


I've added the onbeforeunload and it works, every time that I try to
close
thye browser it executes the function, but when I click an hiperling
that
I#'ve got on the page it run the function as well and I only wants that
to
run when the user close the browser.
Thanks
> With the onunload (and also onbeforeunload in IE) event handler.

As in:

<body onunload=3D3D"callFunction()">


/Robert



-----Original Message-----
From: marc cardenas [mailto:marclena@h...]=3D20
Sent: den 11 februari 2003 12:00
To: JavaScript HowTo
Subject: [javascript_howto] events


Does anyone knows how can I capture the event when the user close 
the=3D20
browser in IE and Netscape? Thanks
---
Change your mail options at http://p2p.wrox.com/manager.asp or=3D20 to
unsubscribe send a blank email to 

  Return to Index