Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- DOM CliffsNote
March 15, 2008, 5:19 pm
rate this thread
which was not difficult. However, getting my head around the
DOM is another matter. I have been looking for a CliffsNote
version of how the DOM works, and all of the P/M/E's, but so
far all I have found are: long winded specifications (no time),
web pages that are not really focused on my needs, and would
take a lot of effort to print, and come-ons for books. Anyone
know of some good candidates?
While I'm at it, I have a few questions about the DOM for
HTML. Hope someone can help, or direct me to a news group
1. My understanding is that the Window is the parent or root
level of the tree. Correct? Most of what I have seen on
the web starts at the document level
2. The Window level has objects regarding the browser history,
browser in use, the current link, etc?
3. Frames are also at the window level, not the document?
e-mail: d boland 9 (all 1 word) at fastmail period fm
Re: DOM CliffsNote
Crossposted/f'upped to there.
Afaik, yes. Usually the 'window.' start can be ommitted though. (Formally
you'd use window.document.someThing, however you can use
document.someThing directly without problems.)
current url: check
browser in use: depends, don't rely on it / don't care about it. Heavily
favor checking for (the existance of) needed features instead of sniffinf
Re: DOM CliffsNote
But of course not every object in the program is a DOM object.
If you create a global variable in your JS program, like
var foo = 6;
Then that variable is also known as window.foo.
The document object is a member of the window object that kind of gets
put there magically for you, under the name window.document (or you can
just use the name "document").
In C++ terms "window." means the same as "::".
The methods of the document object are the way into the DOM, for
document.getElementById("foo").style.backgroundColor = "yellow";
That kind of thing.
Yes. The thing is there is one scripting context (i.e. global namespace,
global object, window object) per document.
If you've got frames, you've got several different scripting contexts.
They don't share the global variables. But they do have references to
each others' window objects through window.frames. But that's DOM 0 and