Scripting For The 6.0 Browsers
By Scott Andrew LePera
Revised January 27, 2002 | Printer-friendly version
Granted, Netscape 6 is far from perfect. But with its great support of DOM and CSS, it's a big step in the right direction. Hopefully it'll be the first in a line of popular, successful browsers that will be enthusiastically adopted by the web surfing public and make our lives as developers that much easier.
With the DOM scripting methods you can:
- Create new elements on the fly. No more using document.write to insert HTML and CSS into your page, no more object constructors. The DOM allows you to create whole elements out of thin air.
- Grab all the tags of the document, or grab the text without grabbing the tag text.
- Insert new text, and change or remove text from any element without resorting to innerHTML or document.write().
- Move whole parts of the document around, or remove parts as fragments and work with them.
- And the best part: all of these new methods should work in any DOM compliant browser. No more browser sniffing. No need to build different versions of the same page for different browsers. One common set of scripting techniques is all that's needed.
This article is meant to be a brief, non-technical introduction to DOM scripting, with a focus on Netscape 6. Hardcore spec-heads (huh?) will want to check out the W3C's specifications on DOM and CSS for in-depth, white-papery techie jargon.
Excited yet? Let's look at this DOM thingy.