View Full Version : document.all vs document
Antoniohawk
05-31-2003, 03:13 AM
I was wondering wat the difference between saying document.all.MyStyle.style and document.MyStyle.style was? i have seen the document.all used alot and I have never used it before.
liorean
05-31-2003, 03:20 AM
It's an IE specific way of specifying any element on a page using it's id. The DOM equivalent is to use document.getElementById([string ElementId]) to get it. The document.nameorid syntax only works for images, forms, anchor tags as a short form of the more correct document.images.nameorid, document.forms.nameorid, document.anchors.nameorid.
Ie and nn4 allowed shortcut notation by using only nameorid or using document.nameorid, but that is not the standard way and is something you shouldn't rely on.
Antoniohawk
06-06-2003, 08:33 AM
o ok, thx for the reply
brothercake
06-06-2003, 09:02 AM
In short - don't use either of them. Use document.getElementById("MyStyle").style.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.