Some basic usage in Web standard development (serialization ...)
In Web programming, we usually use a text-based approach, that is, using the vertex method to access and set, such as: Document. All. Id. value = "value"
Browsers that do not support W3C Dom and those that do not support DOM at all
The browser supports this web programming approach (text-based Web programming ).
Before the W3C Dom standard emerged, both ie4 and ns4 of Micrsoft and Netscape had their own Dom standards, browsers that mainly support W3C Dom standards should:
Netscape 6.0 +, Mozilla 0.9 +
IE/win 5 +, ie/MAC 5 +
Opera7 +
And other browsers with few users
Dom standard (Document Object Model) is based on Dom web programming.
In Dom, the HTML document hierarchy is represented as a tree structure. Node representation of the tree
Various content in the document
The following describes some basic usage of Web standard development:
1. obtain a control (ID = "control "):
VaR element = Document. getelementbyid ("control ");
2. If the above control is a tag, obtain its content:
VaR text = element. childnodes [0];
3. Set the properties of the control:
A) Apart from style, class, and Event Response attributes, other attributes can be set as follows:
Element. setattribute ("readonly", "true ");
B) set the class attribute:
Element. setattribute ("calssname", "test ");
C) Set Event Response attributes: (attachevent () is supported by IE, and addeventlistener () must be used in Mozilla ().)
Element. attachevent ("onclick", test); (ie5/MAC is not supported)
Element. addeventlistener ("eventtype", listenerreference, captureflag); (ie5/MAC is not supported)
(The first parameter is a string that declares the event type (without the "on" prefix), such as click, mousedown, and keypress. The second parameter of the addeventlistener () method can be treated the same as the function reference described earlier. The third parameter is a Boolean value, indicating whether the node uses the so-called capture mode in the dom-combined as event propagation-which is finally described in another article. For a typical event listener, the third parameter should be false ).) To listen for events. Event capturing and dispatching