Home >Web Front-end >JS Tutorial >JS document.all function usage example_Basic knowledge
1.
document.all is a collection of all elements in the page. For example:
document.all(0) represents the first element in the page
2.
document.all can determine whether the browser is IE
if(document.all){
alert ("is IE!");
}
3.
You can also set the id attribute (id=aaaa) to an element, and then call the element with document.all.aaaa
4 .
Case:
Code 1: