1, DOM
The Web Standard is now hot in hot, but the discussion below is a Document.All that does not meet the standard.
Dom - Document Object Model Document Object Model provides a way to access document objects.
For example, there is a table in the document, you have to change its background color, you can access this table with Document.all [] in JavaScript. But DOM is also different, because
For the competition between browser manufacturers, all browser manufacturers have developed their private DOM, which can only run correctly on their own browsers. Document.all [] is only running
IE is
Microsoft's private DOM. In order to correctly understand DOM, give IE4 DOM
2, understand Document.all []
Object Model from IE4 IE adds Document.all [] to see DosisT.All [] Description:
Array of all html tags in the document.collection of all elements contained by the object.
That is to say, Document.all [] is an array variable consisting of all tags in the document, including all elements in the document object (see Example 1).
IE's Document.all Collection Exposes All Document Elements.this Array Provides Access To Every Element in The
Document.
Document.all [] This array can access all elements in the document.
Example 1 (This can make you understand which objects are objects)
"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
hEAD>
this is a paragraph em>. it is only a paragraph. em> p>
yet another paragraph. em> p>
this final paragraph em> HAS Special Emphasis. em> p>
Var i, Origlength;
Origlength = document.all.length;
Document.write ('Document.all.Length =' Origlength " { Document.write ("Document.all [" i "] =" Document.All [i] .tagname " } // -> script> body> html> [Ctrl A All Select Tips: You can modify some code first, press Run] Example 2 (Access a specific element)
"http://www.w3.org/tr/html4/loose.dtd">
"); for (i = 0; i
");
#docid {
HEIGHT: 400PX;
Width: 400px;
Background-color: # 999;
->
style>
hEAD>
body>
html>
Function bgcolor () {
Document.all [7] .style.backgroundcolor = "# 000"
}
->
script>
[Ctrl A All Select Tips: You can modify some code first, press Run]
The above example allows you to know how to access a specific element in the document, such as a DIV in the document
You can access this DIV through this DIV ID, Name or INDEX property:
Document.all ["docid"]
Document.all ["docname"]
Document.all.Item ("DOCID")
Document.all.Item ("DOCNAME")
Document.all [7]
Document.all.tags ("div") returns all DIV arrays in the document. There is only one div in this example, so you can access it with Document.All.tags ("DIV") [0].
3, use document.all []
Example 3
hEAD>