Mouse click event
Ondblclick
Mouse double click event
Onmouseover
Mouse move in event
Onmouseout
Mouse removal event
Onmousemove
Mouse movement event
Onmousedown
Less mouse click event
Onmouseup
Less use of the mouse release event
Keyboard event
Execution order: onkeydown → onkeypress → onkeyup.
Onkeydown
Press key events (including numeric keys, function keys)
Onkeypress
Press key event (only numeric keys included)
Onkeyup
Release key events (including numeric keys, function keys)
Form event
(1) onfocus event; get focus triggered event
(2) onblur event; loss of focus triggered event.
(3) onchange event; the event triggered by the selection of the drop-down list item is
(4) onselect event; event triggered when single-line text box text or multi-line text box textarea text
There are 3 elements with focus and lost focus events:
(1) single line text box text;
(2) Multi-line text box textarea;
(3) drop-down list select;
Edit event
(1) copy event oncopy;
(2) cutting event oncut;
(3) Paste event onpaste;
Page related event
(1) onload (load event); onload event indicates the event executed after the document is loaded
Window.onload=funcTIon(){
......
}
(2) onresize (page size event);
(3) onerror (error event);
The onscroll event fires when the element scroll bar is scrolling
addEventListener() method
element.addEventListener(event, funcTIon, useCapture);
The first parameter is the type of event (such as "click" or "mousedown").
The second parameter is the function called after the event is triggered.
The third parameter is a Boolean value that describes whether the event is bubbling or capturing. This parameter is optional.
Note: Do not use the "on" prefix. For example, use "click" instead of "onclick".
Add an event handler to the original element
element.addEventListener("click", funcTIon(){ alert("Hello World!"); });
Add multiple event handles to the same element
element.addEventListener("mouseover", myFuncTIon);
element.addEventListener("click", mySecondFunction);
Add an event handler to a Window object
window.addEventListener("resize", function(){
document.getElementById("demo").innerHTML =sometext;
});
Passing parameters
element.addEventListener("click", function(){ myFunction(p1, p2); });
removeEventListener() method
The removeEventListener() method removes the event handle added by the addEventListener() method:
element.removeEventListener("mousemove", myFunction);
Basic Physics Experiment Instrument Series
Basic physics experiment instrument series, used in physics laboratories of colleges and universities.
Basic Physics Experiment Instrument,Light And Optical Instruments,Optical Viewing Instrument,Microscope Light Source Instrument
Yuheng Optics Co., Ltd.(Changchun) , https://www.yhenoptics.com