Quad selector: class, ID, name, label
To get an object from a selector:
Document.getelementbyId('); --ID Selector
................................... ClassName (‘‘); --Class Selector
............................... Name ("); --Name Selector
................................ TagName ("); --Tag Selector (that is, Div.) Tag name such as input)
Gets the element into the variable (except for the ID, the other gets the array, the index value should be used)
var A=document.getelementbyid ("Element id"); "The type has only one value, and the operation uses a. Event directly"
var a=documenr.getelementbyclassname ("Class name"); "The type is an array that can use a for loop for a single element operation within a group: A[i]. Event"
Three events
1. Click events [onclick]
A.onclick=function () {}
2. Mouse move-in event [onmouseover]
A.onmouseover=function () {}
3. Mouse out event [onmouseout]
A.onmouseout=function () {}
Control the style of the marker
1. Element tag. style. style = "value";
Change the background color of the ID ' AA ' to Black: aa.style.backgroundcolor= "red";
Here the Background-color becomes Backgroungcolor, is the JS in all the "-" attributes are removed, and the first letter behind it becomes uppercase.
2. The first element is a[0] When the array data is traversed for a loop.
To mark style operations on an element in a loop, use this as the object to be drawn
This represents the element that triggered the event. (PS: Click the event for example, the mouse click on that div,this is that div)
This.index = i; The object that is attached to the index is itself, and the index inside it is a sequence number.
JS changed style changes all styles (inline style with highest precedence)
Javascipt--windows.document Object