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