Sys.Application.init 事件

更新:2007 年 11 月

在加载所有脚本之后,创建对象之前引发。

Sys.Application.add_init(handler);
Sys.Application.remove_init(handler);

参数

  • handler
    要从 init 事件绑定或取消绑定的委托函数。

备注

将委托函数附加到 init 事件,以完成在创建对象之前必须执行的任务。add_init 访问器将委托函数绑定到 init 事件,而 remove_init 访问器则取消绑定该函数。

示例

下面的示例演示如何将一个处理程序添加到 init 事件。该事件处理程序将两个自定义控件添加到页面。

// Attach a handler to the init event.
Sys.Application.add_init(applicationInitHandler);

function applicationInitHandler() {
    // Add two custom controls to the application.
    $create(Demo.HoverButton, {text: 'A HoverButton Control'}, 
        {click: start, hover: doSomethingOnHover, 
        unhover: doSomethingOnUnHover},
        null, $get('Button1'));
    $create(Demo.HighVis, null, null, null, $get('Button2'));
}

请参见

参考

Sys.Application 类

其他资源

语言参考