DOM CliffsNote

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I spent a day getting to know JavaScript (already know C/C++),
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
better suited.

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

Quoted text here. Click to load it

Which makes your question more suited to comp.lang.javascript.  
Crossposted/f'upped to there.

Quoted text here. Click to load it

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.)

Quoted text here. Click to load it

history: check
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  

Quoted text here. Click to load it

Guess so.

Not really helpfull from my side, my javascript is really rusty, but  
probably you get a more authorative/complete answer in c.l.javascript.
Rik Wasmus

Re: DOM CliffsNote

Quoted text here. Click to load it

comp.lang.javascript is probably better.

Quoted text here. Click to load it

The window is the JavaScript "global object", so it's the root of the
tree of objects in your JavaScript program.

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

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.write("hello world");
document.getElementById("foo").style.backgroundColor = "yellow";


Quoted text here. Click to load it

That kind of thing.

Quoted text here. Click to load it

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
not standard...

Better to try comp.lang.javascript, I've set the followup.

Re: DOM CliffsNote

Quoted text here. Click to load it

Short & sweet: /

They also have HTML, CSS and MySQL sheets.

(Not affiliated, just a satisfied customer.)

Philip /
Whole-site HTML validation, link checking and more

Site Timeline