part2 review
Prevent a hyperlink to jump event of default: return false;
Getting element of fashion
Gets the element according to id
document.getElementById ( "id attribute value");
Gets the element according to the label name
document.getElementsByTagName ( "name tags");
Some browsers do not support, IE low version of the browser is not supported, IE8 less
Get The value of the name attribute of the element
document.getElementsByName ( "value of the name attribute");
Getting an element based on the class style name
document.getElementsByClassName ( "class style name");
The selector element acquires
document.querySelector ( "selector"); return an object
Eradicate selector obtain elements
document.querySelectorAll ( "selector"); return array, the plurality of elements
Set the style elements of way
Object .style attribute = value;
Object .className = value;
innerText and textContent compatibility issues
The current browsers support innerText, it should belong to ie standards
textContent itself is supported by Firefox, IE8 does not support
InnerHTML and the difference innerText
You can set the label text, label, and if you want to use innerHTML content recommendation
If you want to get the text label, innerText, can also be used innerHTML
If you want to get that label, but also text --- innerHTML
Custom properties operations
Custom attributes: the original labels do not have this property, in order to store data, programmers add their own properties
Custom attributes can not be directly through the DOM object way to get or set
Object .getAttribute ( "custom property name"); get custom property value
Object .setAttribute ( "attribute name", "value"); and a value set custom properties
Remove custom properties
Object .removeAttribute ( "property name");
The completion of the project ==== say random roll call at night
part3 Courses
node
Why study node
Node attributes related operations ------> effect
12 lines of code useful ---- ---- skilled problem,
Case node
------ focus on three ways to create content elements
Why have created elements
Adding elements
Remove elements
Events