The original cheat sheet (PDF version) is here to download: http://aspnetresources.com/downloads/ms_ajax_library_cheat_sheets1.zip
Original copyright statement:
Copyright (c) 2004-2006, Milan negovan http://www.AspNetResources.comAll rights reserved. redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * redistributions of source code must retain the above copyright notice, this list of conditions and the following disclawing. * redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclawing in the documentation and/or other materials provided with the distribution. * The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. this software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited, the implied warranties of merchantability and fitness for a special purpose are disclaimed. in no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
NOTE: If [s] is marked as a static method, it can be used without instantiating an object.
[S] addhandler (element, eventname, Handler)
[S]$ Addhandler (element, eventname, Handler)
Add the processing function of an event to the DOM element. The "on" prefix should be removed from the event name.
Note: In the event processing function, this points to the element, not necessarily the element that sends the event.
SYS. UI. domevent. addhandler (element,"Click", Clickhandler );
// Same as $ addhandler (element, "click", clickhandler );
FunctionClickhandler (e ){... }
[S]Addhandlers (element, events, handlerowner)
[S]$ Addhandlers (element, events, handlerowner)
Add multiple event processing functions to the DOM element. events is the dictionary of an event processing function.
NOTE: If handlerowner is specified in the event processing function, this points to the handlerowner. Otherwise, this points to the element.
$ Addhandlers ($ get ("Article"),{
Mouseover: onmouseover,
Mouseout: onmouseout
});
FunctionOnmouseover (e ){This. Style. backgroundcolor ='Yellow';}
FunctionOnmouseout (e ){This. Style. backgroundcolor ='White';}
[S]Clearhandlers (element)
[S]$ Clearhandlers (element)
Removes all event handlers from the specified Dom element.
SYS. UI. domevent. clearhandlers (element );
// Same as $ clearhandlers (element );
[S]Removehandler (element, eventname, Handler)
[S]$ Removehandler (element, eventname, Handler)
Removes the specified event handler for the DOM element.
SYS. UI. domevent. removehandler (element,"Click", Clickhandler );
// Same as $ removehandler (element, "click", clickhandler );
Preventdefault ()
Blocks the execution of default event processing functions. For example, if the onclick event of Element A is blocked, page navigation is not triggered.
$ Addhandler ($ get ("Showmorelink"),"Click", Showmore );
FunctionShowmore (e) {e. preventdefault ();}
Stoppropagation ()
Prevents event bubbles from being passed to the parent element.
Attribute of event object
- altkey : determines whether the Alt key is pressed when the event is triggered.
- button : click the mouse that triggers the event. Optional values: SYS. UI. mousebutton enumeration (leftbutton, middlebutton, and rightbutton ).
- charcode : Enter the Code button on the keyboard when the event is triggered. You can enumerate SYS. UI. Key (backspace, tab, enter, ESC, space, Pageup, Pagedown, end, home, left, up, right, down, del ).
- clientx : X coordinate of the mouse pointer relative to the visible area of the document.
- clienty : Y coordinate of the mouse pointer relative to the visible area of the document.
- ctrlkey : determines whether the ctrl key is pressed when the event is triggered.
- offsetx : the offset of the mouse pointer to the left edge of the trigger event element.
- offsety : the offset of the cursor to the edge of the trigger event element.
- rawevent : the original DOM event.
- screenx : The X coordinate of the mouse pointer relative to the viewer's screen.
- screeny : Y coordinate of the mouse pointer relative to the viewer's screen.
- shiftkey : determines whether the Shift key is pressed when the event is triggered.
- Target : the object that triggers the event.
- type : event name (for example, click ").