JavaScript event handling with Sitemagic CMS
The
SMEventHandler class allows for developers to register event handlers with just one line of code, without the need to write browser specific code.
function onLoadHandler()
{
alert("Page done loading");
}
SMEventHandler.AddEventHandler(window, "load", onLoadHandler);
The AddEventHandler function takes three arguments: The element which fires the event, the name of the event (without the "on" prefix - i.e. "onload" becomes "load"), and a reference to the event handler function. Also notice that since most versions of Internet Explorer does not support event capturing, only event bubbling is supported.