PHP Rookie learning process -1 JS advanced -34-yesterday content review

Source: Internet
Author: User

JS Advanced -34-Yesterday Content review time: 2015-5-11

1. Dom Gets the element node

Document.getelenmentbyid (id attribute value) concrete element Node object

Document.getelenmentsbytagname (Tag tag name Div ul li) array list

Document.getelenmentsbyname (Name property value) array list

2. Dom gets attribute node and property operation

Node.attributes; Array list

Node.attributes. Attribute name; Get the specific Attribute node object

Node.attribute[' class ' Gets the class attribute node

Property manipulation

Operation of the properties of the rules

node. Attribute name; Get attribute Information

Node. property name = attribute value; modifying property information

To manipulate the class property, you need to set it to the classname name.

Node.classname;

Manipulating the rules and custom properties

Node.getattribute (attribute name);

Node.setattribute (name, value)

3. Dom gets text node

<div>hello</div>

Divnode.firstchild; Get text node

NodeType:

1-element node

2-Attribute Node

Text Node 3

4, document node

LastChild; ChildNodes nextSibling previoussibling parentnode

4, Dom each node creation, append

Create:

Element node Document.createelement (tag tag name)

Text node document.createTextNode (text content)

Property Node.setattribute (property name, value)

Additional

Parent node. appendchild (child node);

Parent node. insertbefore (New,old);

Parent node. replacechild (New,old);

5. DOM node deletion and replication

Delete:

Parent node. removechild (Child node)

Copy:

node. CloneNode (True deep copy/false shallow copy);

6. Dom Operation CSS Style

Node.style. Style name; Get Style Property Information

Node.style. Style name = value; Set Style Property information

Attention:

① self-operating inline style

② actions conform to attributes (for example: Background-color, Border-left, Margin-bottom), the middle line is stripped of the upper capital letters, BackgroundColor, Borderleft, MarginBottom

7. Dom2-mode event settings

PHP Rookie learning process -1 JS advanced -34-yesterday content review

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.