Microsoft Ajax

0.eval() 函数可计算某个字符串,并执行其中的的 JavaScript 代码。
snippets:
document.write(eval("2+2"))
var x=10
document.write(eval(x+17))

1.$get(id, element)
id:The ID of the DOM element to find.
element:The parent element to search. The default is the document element.

snippets:
// 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);


2.$addHandler(element, eventName, handler, autoRemove);
Provides a shortcut to the addHandler method of the Sys.UI.DomEvent class. This member is static and can be invoked without creating an instance of the class.
element:The DOM element that exposes the event.
eventName:The name of the event.
handler:The event handler to add.
autoRemove:(Optional) A boolean value that determines whether the handler should be removed automatically when the element is disposed.

snippets:
<script type="text/javascript">
    $addHandler($get("Button1"), "click", processEventInfo);
    var myArray = ['altKey', 'button', 'charCode', 'clientX', 'clientY',
                   'ctrlKey', 'offsetX', 'offsetY', 'screenX', 'screenY',
                   'shiftKey', 'target', 'type'];

    // Event handler displays element properties specified in array
    function processEventInfo(eventElement) {
        var result = '';
        for (var i = 0, l = myArray.length; i < l; i++) {
            var arrayVal = myArray[i];
            if (typeof(arrayVal) !== 'undefined') {
                // Example: eventElement.clientX
                result += arrayVal + " = " + eval("eventElement." + arrayVal) + '<br/>';
            }
        }
        $get('Label2').innerHTML = result;
    }
 </script>

3.$addHandlers(element, events, handlerOwner, autoRemove);
snippets:
<script type="text/javascript">
    $addHandlers($get("Button1"), {click:processEventInfo,mouseover:processEventInfo,mouseout:processEventInfo});

    // Event handler displays types for multiple events
    function processEventInfo(eventElement) {
        var result = '';
        result += eventElement.type;
        $get('Label2').innerHTML = result;
    }
 </script>

4.$clearHandlers(element);
snippets:
<script type="text/javascript">
    $addHandlers($get("Button1"), {click:processEventInfo,mouseover:processEventInfo,mouseout:processEventInfo});
    $addHandler($get("Button2"), "click", clearAllHandlers);

    // Event handler displays types for multiple events
    function processEventInfo(eventElement) {
        var result = '';
        result += eventElement.type;
        $get('Label2').innerHTML = result;
    }

    // Event handler clears all events from Button1
    function clearAllHandlers(eventElement) {
        $get('Label2').innerHTML = '';
  $clearHandlers($get("Button1"));
    }
 </script>

6.$find(id, parent);
Provides a shortcut to the findComponent method of the Sys.Application class. This member is static and can be invoked without creating an instance of the class.
snippets:
function checkComponent() {
    if (!($find('MyComponent', div1))) {
        div1.innerHTML = 'MyComponent is not available.';
    }
}

7.$removeHandler(element, eventName, handler);
snippets:
function removeClick(eventElement) {
  $removeHandler($get("Button1"), "click", processEventInfo);
    }


8.JavaScript Base Type Extensions
Array Type Extensions
Provides extensions to the base JavaScript Array object.

Boolean Type Extensions
Provides extensions to the base JavaScript Boolean object.

Date Type Extensions
Provides extensions to the base JavaScript Date object.

Error Type Extensions
Provides extensions to the base JavaScript Error object.

Number Type Extensions
Provides extensions to the base JavaScript Number object.

Object Type Extensions
Provides extended reflection-like functionality to the base JavaScript Object object.

String Type Extensions
Provides extensions to the base JavaScript String object.

链接地址:http://msdn.microsoft.com/en-us/library/bb397506(v=vs.100).aspx

9.Microsoft Ajax Library Client Reference
The Microsoft Ajax Library includes a rich framework to simplify client programming. This lists the Microsoft Ajax Library namespaces.
链接地址:http://msdn.microsoft.com/en-us/library/bb397536(v=vs.100).aspx

10.Microsoft Ajax
链接地址:http://msdn.microsoft.com/en-us/library/ee341002(v=vs.100).aspx

转载于:https://www.cnblogs.com/myphh/archive/2012/10/25/2739318.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值