First, find the element
document.getElementById ("id"): Based on the ID to find a layer, up to find a
var A=document.getelementbyid ("id"): Place the found element in variable A;
Document.getelementbyname ("name"): Based on name, find out the array;
Document.getelementbytagname ("name"): Based on the name of the tag, find out the array;
Document.getelementbyclassname ("name"): According to ClassName, find out the array;
Ii. contents of operation
1, non-form elements
1), alert (a.innerhtml): Get the HTML content inside the a tag,
2), alert (a.innertext): Only get the text inside the A tag
2. Form elements
1), Var a=document.f1.t1; Gets the form form IDF1 input with ID t1
2), alert (t.value); Gets the value in input
3), alert (t.innerhtml): Gets the value of table cell <textarea> </textarea>
4), setting content: t.value= "content change";
5), attribute onclick= "return flase": Will not jump, the button will not be submitted
Third, attribute control
1), A.setattribute (property name, property value): Sets a property. Add or change all can;
2), A.getattribute ("Property name"): Gets the value of the property
3), A.removeattribute ("Property name"): Removes an attribute.
Four, Operation style
1), a.style. style = "": Manipulate this ID style property
2), a.classname= "ClassName in style sheet" to manipulate a batch of styles.
JavaScript Document Object Usage (very important)