Possible Duplicate:
document.all vs. document.getElementById
I'm refactoring some old code written by somebody else. And I came across the following snippet:
if (document.all || document.getElementById) {
...
}
When will the code within the if-statement be executed?
Thank you!
document.all() is a non-standard way of accessing DOM elements. It's been deprecated from a few browsers. It gives you access to all sub elements on your document.
document.getElementById() is a standard and fully supported. Each element has a unique id on the document.
来源:https://stackoverflow.com/questions/13663023/what-does-document-all-mean