One.
Document.all is a collection of all elements within a page. For example:
DOCUMENT.AA (0) represents the first element within a page
Two.
Document.all can tell if the browser is IE
if (document.all) { alert ("is ie!") );}
Three.
You can also invoke the element with DOCUMENT.ALL.AAAA by setting the ID property (ID=AAAA) for an element.
Four.
Case:
Code Listing 1:
<inputname= "AAA"value= "AAA"><inputID= "BBB"value= "BBB"><Script>alert (document.all.aaa.value)//take value by namealert (document.all.bbb.value)//take value by ID</Script>
Code Listing 2:
But often the name can be the same (for example, using a checkbox to take a user's many hobbies)
<inputname= "AAA"value= "A1"><inputname= "AAA"value= "A2"><inputID= "BBB"value= "BBB"><Script>alert (DOCUMENT.ALL.AAA (0). Value)//Show A1alert (DOCUMENT.ALL.AAA (1). Value)//Show A2alert (DOCUMENT.ALL.BBB (0). Value)//This line of code will fail</Script>
Code Listing 3:
In theory, the ID of a page is different from each other, and if there are various tags with the same id,document.all.id will fail, like this:
<inputID= "AAA"value= "A1"><inputID= "AAA"value= "A2"><Script>alert (document.all.aaa.value)//show undefined instead of A1 or A2</Script>
Code Listing 4:
For a complex page (the code is very long, or the ID is automatically generated by the program), or a JavaScript beginner to write a program, it is likely to appear two tags have the same ID case. In order to be programmed without error, it is recommended that:
<inputID= "AAA"value= "Aaa1"><inputID= "AAA"value= "Aaa2"><inputname= "BBB"value= "BBB"><inputname= "BBB"value= "Bbb2"><inputID= "CCC"value= "CCC"><inputname= "DDD"value= "DDD"><Script>alert (document.all ("AAA",0). Value); Alert (document.all ("AAA",1). Value); Alert (document.all ("BBB",0). Value); Alert (document.all ("BBB",1). Value); Alert (document.all ("CCC",0). Value); Alert (document.all ("DDD",0). value);</Script>
Source: http://www.cnblogs.com/uedt/articles/1691443.html
document.all usage