What does document.all mean? [duplicate]

旧城冷巷雨未停 提交于 2019-11-28 00:54:24

问题


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!


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!