JS DOM manipulation and animation

Source: Internet
Author: User

the DOM operation of JS
Dom:document Object Model
Bom:bowers (browser) Object Model

Find the element: Var A=document.getelementbyid ("id"), put the found element in the variable;
ID selector: document.getElementById ("id"), according to the ID, find at most one;
Class selector: Document.getelementclassname ("name"), according to ClassName, find out the array;
Tag Selector: document.getelementtagname ("name"), based on the name of the tag, find the array;
Name selector: document.getelementbyname ("name"), based on name, finds the array;
Operating content: InnerHTML tags in the code and text are obtained;
InnerText can only take text;
Operation Properties: Var A=document.getelementbyid ("id");
A.setattribute ("attribute name", "attribute value"); Set a property that can be added or changed;
A.getattribute ("attribute name"); Gets the value of the property;
A.removeattribute ("attribute name"); remove an attribute;
Operation style: A.style. style = "";

Animation
CSS transitions (gradient effect)
JS setinterval
Clearinterval
CreateElement:
var op = createelement ("label name")
Op. properties
Appendchild:appendchild (object name): Op
RemoveChild
onchange: Changing Events


JS DOM manipulation and animation

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.