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