How to get elements in JS:
1. Get elements by ID name:
Document get element by id ' link '
Docuemnt.getelementbyid (' link ');
2
......
Events: Mouse events, keyboard events, system events, form events, custom events ...
OnClick
onmouseover
onmouseout
OnMouseDown
OnMouseUp
OnMouseMove is like a mouse stroke event.
......
OnLoad executes after loading ...
Window.onload = Things
Img.onload
Body.onload
......
How to add an event:
element. onmouseover
Function: Can be understood as-command, do something ~ ~
Function abc () { //must not be actively executed!
......
}
1, direct call: ABC ();
2. Event invocation: element. event = function name Odiv.onclick = ABC;
function () {} anonymous functions
element. event = function () {};
Test:
Alert (1); A warning box with a OK button
Alert (' OK '); ' Ok ' string
Alert ("OK");
Variable:
var li = document.getElementById (' lis ');
var num = 123;
var name = ' Leo ';
*/
Js0-warm-up exercise, JS Starter Tutorial