Monday, May 13, 2024
141
rated 0 times [  144] [ 3]  / answers: 1 / hits: 25913  / 12 Years ago, sat, december 1, 2012, 12:00:00

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!


More From » getelementbyid

 Answers
35

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.


[#81670] Friday, November 30, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
clarkulisesa

Total Points: 422
Total Questions: 93
Total Answers: 112

Location: Austria
Member since Thu, Jan 7, 2021
3 Years ago
clarkulisesa questions
Mon, Feb 24, 20, 00:00, 4 Years ago
Mon, Aug 12, 19, 00:00, 5 Years ago
;