The Document object is part of the Window object and can be accessed through the Window.document property
Usually through the JS can manipulate HTML elements, first of all to find this element;
- By using the getElementById ("id") method//id the label has only one
- Find an array by using the getElementsByTagName ("") method//based on the tag name
- By using the Getelementsbyclassname ("") method//Based on classname, locate the array
- By using the Getelementsbyname ("") method//Based on name, find the array Zhu: enclosed in parentheses
Window Object properties and Properties http://www.runoob.com/jsref/obj-window.html
Document Operation:
1, find elements get element 、、、
2, Operation content innerHTML
Non-element content properties:. InnerHTML Sets or returns the contents of the element//Example: Documentgetmentbyid ("id"). InnerHTML (content within the element is:)
Form element content properties:. value
Element link:. href page Jump form:. target~~
<script>function changelink () { document.getElementById (' Myanchor '). innerhtml= "Gold Baidu" ; document.getElementById (' Myanchor '). href= "Http://www.baidu com"; document.getElementById (' Myanchor '). target= "_blank";} </script>
link and jump chestnuts3. Operation Properties:
Set SetAttribute ("Properties", "Property values")
Get getattribute ("attribute name")
Delete RemoveAttribute ("Property name")
Chestnut
4. Function Style:
element. style. style = "";
<script type= "Text/javascript" >function on (obj) { = ' 200px '; = "200px"; } </script> >
function Style chestnut5. Operation elements (create tags, delete tags)
Time Control:
SetInterval (): Invokes a function or evaluates an expression by the specified period (in milliseconds).
SetTimeout (): Invokes a function or evaluates an expression after the specified number of milliseconds.
JavaScript DOM content/operation steps