htmL:
Small class summary:
1. Three ways to register events: onclck (normal), addEventListener (multiple registrations, no coverage, only supported after IE9), attachEvent (same effect as before, old version: supported by IE6-10);
2. Remove the event: btn.onclick = null;, removeEventListener('event name', function name (cannot be an anonymous function))
3. The effect of the third parameter of addEventListener (the default value is false;):
1. If the parameter is false, execute from inside to outside: event bubbling
2. Execute from outside to inside when the parameter is true: event capture
4. Event delegation: principle bubbling event;
1. e (event) event parameter, window.event is compatible with older browsers
2. e.target is the event that is actually triggered;
3. The object to which the e.currentTarget event processing belongs is equivalent to this;
4. e.type event name
5. . . . . . Multiple can print console.log(e)
6. e.clientX, e.clientY according to the coordinates of the mouse pointer in the visible area of the browser
7. e.pageX, e.pageY according to the coordinates of the mouse pointer on the page (+ scroll bar
8. Get the scroll distance of the scroll bar
console.log(document.documentElement.scrollLeft)
console.log(document.documentElement.scrollTop)
9, the offset left offsetLeft, offsetTop (that is, the distance around a region)
10. Keyboard events keydown (keyboard down) keyup (keyboard release)
console.log(e.keyCode) keyboard code