function true)
The last parameter in the AddEventListener determines the order in which the event responds;
If true, the event is executed in the order of AddEventListener----The onclick event of the label----Document.onclick
If the order of the event is false for the OnClick event of the label----Document.onclick----AddEventListener
Mouse events
Document.addeventlistener (' MouseDown ', MouseDown); Document.addeventlistener (' click ', MouseClick); Document.addeventlistener (' MouseUp ', MouseUp);
Touch events
Document.addeventlistener (' Touchstart ', Touchstart);d ocument.addeventlistener (' touchend ', Touchend) ; Touchstart event: Triggers when the finger touches the screen, even if there is already a finger on the screen that triggers the //Touchmove event: A continuous trigger when the finger is sliding on the screen. During this event, the call to the Preventdefault () event can block the scrolling//Touchend event: triggered when the finger is left on the screen. //Touchcancel event: triggered when the system stops tracking touch. The exact departure time for this event is not specified in the documentation, but to guess
(The performance on an iOS device is a call to automatically end the Touchstart event after a period of time)
Each touch event comes with three properties touches: An array of touch objects that represent the touching operations that are currently being traced. targettouches: An array of touch objects that are specific to the event target. Changetouches: Represents the array of touch objects that have changed since the last touch each touches comes with ClientX: Touch the x-coordinate of the target in the viewport. ClientY: Touch the y-coordinate of the target in the viewport. identifier: Identifies the unique ID of the touch. PageX: Touch the x-coordinate of the target in the page. Pagey: Touch the y-coordinate of the target in the page. ScreenX: Touch the x-coordinate of the target in the screen. ScreenY: Touch the y-coordinate of the target in the screen. Target : Touch destination DOM node destination
Support:
WebKit browser in iOS version safari, Android version WebKit, bada version dolfin, BlackBerry 10.1+ in os6+, Opera Mobile Phantom and LG Proprietary OS. Currently only the iOS version of Safari supports multi-touch. PC version of Firefox 6+ and Chrome also supports touch events
code Example 1
var gotouch=function() { alert (' Touchstartok ');} Document.addeventlistener ("Touchstart", Gotouch);
public override function AddEventListener (
Type:string,
Listener:function,
Usecapture:boolean = False,
Priority:int = 0,
Useweakreference:boolean = False
): void
code Example 2
function Go () { //... }
false );
// or listener is directly a function .
function false );
document.getElementById ("Testbutton"). RemoveEventListener ("click", Go); // Delete listener events
About JS's addeventlistener and some common events