Learn JS Basics Operation Summary

Source: Internet
Author: User

1.

Open page: window.open ();

Close page: Window.close ();

2.

The timer has a return object that returns the object of this timer

SetInterval ();//serial Bomb interval execution

SetTimeout ();//Time Bomb delay execution

Cleaning timers

var sett = setTimeout (function () {

Console.log ("settimeout timer");

},3000);

var sett1 = setinterval (function () {

Console.log ("setinterval timer");

},1000);

function closedsq () {

Cleartimeout (sett);//Clear Delay Timer

}

function closedsq1 () {

Clearinterval (SETT1);//clear the serial timer

}

3.

Page loading complete

Window.onload=function () {

}

4.

Find element

To find a specific element, the element object is returned:

Finding a class of elements returns an array of multiple element objects:

5.

Manipulating elements

Manipulating the contents of an element

Non-form elements: dom.innerhtml

Form elements: Dom.value

6.

Manipulating element properties

Dom.getattribute ("AAA");//Get property value

Dom.setattribute ("id", "dd");//Set property value

Dom.removeattribute ();//Remove attribute values

7.

manipulating element styles

Dom.style.color;

8. Manipulating element Events

1. Add event attributes directly inside the tag

2. Dom.onclick = function (e) {}

3, Dom.addeventlistener (event name, method name);

Dom.removeeventlistener (method name);

9. Action element Add Delete

var d = document.createelement ("div")

D.innerhtml

D.styl

D.set

Dom.appendchild (d);

Dom.remove ();

<TD onclick= "Editthis (This)" > ' +stus[k][0]+ ' </td>

Learn JS Basics Operation Summary

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.