Please note that ExpatTech is close for the Christmas and New Year holidays. We will re-open on 2nd January 2024.

ExpatTech Techblog

Nagy Richárd 2009.03.30. 16:16

Global Javascript Events

If you want to catch ex. every mouseclick on the whole page, you should attach the event to document.body. This will work with both Firefox (addEventListener) and IE (attachEvent).

If you want to attach the onload event globally (fires when the page is loaded), you can attach it to window.