what is the difference b/w document.all() and document.getEle mentById()
java scripyt
Collapse
X
-
You should ask your Java questions in the Java Forum section, not the JavaOriginally posted by vin21what is the difference b/w document.all() and document.getEle mentById()
Articles section. I'll move your question to the Java Forum section.
kind regards,
Jos -
This question is of javascript, you should ask javascript questions in javascript forum, not in java forum. You will be guided there better.Originally posted by vin21what is the difference b/w document.all() and document.getEle mentById()
document.all() is a non-standard way of accessing DOM elements. It was originally started by IE. Other browsers either depricated it or don't support it. document.all gives you access to all the elements on your element.
On the other hand document.getEle mentById is a standard way of accessing the elements on the document. Each element have a unique id on the document which can be defined by id attribute of that element.
So if you have <div id="abc"></div>
and you do document.getEle mentById("abc") ; then you will have access to that div.
But remember never give same ids to two different elements, else you could have unexpected results.Comment
Comment