Export (0) Print
Expand All

Sys.Application.load Event

Raised after all scripts have been loaded and the objects in the application have been created and initialized.

Sys.Application.add_load(handler);
Sys.Application.remove_load(handler);

handler

The delegate function to bind or unbind from the load event.

Attach delegate functions to the load event to complete any tasks that must be performed after the objects have been created in the application and when they can reference each other. The add_load accessor binds a delegate function to the load event, and the remove_load accessor unbinds it. The load event occurs immediately before the pageLoad event.

The following example shows how to add a handler function to the load event. The event handler redirects the user to another page if the application is loaded outside business hours.


// Attach a handler to the load event.
Sys.Application.add_load(applicationLoadHandler);

function applicationLoadHandler() {
    // Redirect to alternate page if not business hours.
    var d = new Date();
    if (!(8 < d.getHours() < 17)) {
        window.location = "AfterHours.aspx";
    }
}


Community Additions

ADD
Show:
© 2014 Microsoft