web API (created) for the operation of dom (events focusing on operations and property operations) (add, delete, change, check)

First, create:

(1)document . write  ;

  (2)innerHTML   ;

  (3)createElement ;

 

Second, the increase:

(1)appendchild ;

(2)insertBefore ;

 

Third, delete:

(1)removechild ;

 

Fourth, modified:

1. The main element attribute change dom, dom element content, attribute value of the form and the like;

(1) Modify element attributes: src, href, title and the like;

(2) modify the contents of common elements: innerHTML, innerText;

(3) Modify elements form: value, type, disabled and the like;

(4) modifying element style: style, className;

 

Fifth, the query:

1. Major obtain query dom elements;

API methods (1) DOM provides: getElementByld, getElementsByTagName (old usage is not recommended);

(2) providing a new method H5:  querySelector, querySelectorAll   (advocate the use);

(3) using the node acquires operating elements: Parent (parentNode), child (children), brother (previousElementSibling, nextElementSibling) : advocate the use ;

 

Sixth, property operations:

1. The main target in the custom properties;

(1) setAttribute: dom attribute values ​​are provided;

(2) getAttribute: obtain an attribute value of dom;

(3) removeAttribute: removing property;

 

Seven: Event Action (see web API senior events);

 

Guess you like

Origin www.cnblogs.com/piyangtao/p/11534017.html