js0-warm-up exercise, JS introductory tutorial

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.