Sys.UI.DomElement $get 方法
提供了一个Sys.UI.DomElement类中getElementById方法的快捷访问方式。静态成员,无须实例化即可使用。
语法
$get(id, element);
参数 | 描述 |
---|---|
id | 要寻找的元素的ID。 |
element | 要寻找的父元素,默认为document。 |
以下示例给出了如何用 $get 方法。本示例及方法同样属于 DomElement 类综述结点.
cs
// Add handler using the getElementById method
$addHandler(Sys.UI.DomElement.getElementById("Button1"), "click", toggleCssClassMethod);
// Add handler using the shortcut to the getElementById method
$addHandler($get("Button2"), "click", removeCssClassMethod);
vb
// Add handler using the getElementById method
$addHandler(Sys.UI.DomElement.getElementById("Button1"), "click", toggleCssClassMethod);
// Add handler using the shortcut to the getElementById method
$addHandler($get("Button2"), "click", removeCssClassMethod);