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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With