понедельник, 27 февраля 2012 г.

Dynamite dynamism.(Internet/Web/Online Service Information)

A few weeks ago, "Gearhead" discussed JavaScript and followed that with a discussion of HTML, JavaScript and bookmarklets.

From your letters I get the impression it went well, so this week I thought "Gearhead" would discuss a question posed by a reader after the JavaScript column: "Where does Dynamic HTML fit in?"

While JavaScript can create content in an HTML document, it can also interact with document contents. Combine that ability with content formatting control and you can make Web documents with amazingly sophisticated behavior, what Dynamic HTML is all about.

For example, you can make toolbars on Web pages that stay at the top of a window so the toolbars are always visible even when the page is scrolled down. See the section on drifting toolbars on Netscape's DevEdge Online at http://developer.netscape.com/tech/dynhtml/index.html for an example that works with Version 4.0+ of Netscape Navigator and Microsoft Internet Explorer.

At the heart of Dynamic HTML is something called the Document Object Model (DOM) - as if we needed yet another acronym identical to those for Distributed Object Manager, Data Output Message and Document Object Management.

The DOM is (and here's a string of $5 words) "a hierarchical structuring of the contents of an HTML document." What this means is that the HTML elements that comprise a document (links, anchors, images and plug-ins) are arranged in a tree and referred to generically as "objects."

The DOM tree starts from the window in which the document is displayed and includes its location, frames, events that occur and even the history of the window (the URLs that have been displayed in that window). Events in the model include loading and unloading the document, and when the mouse interacts with an object by moving across or away from it, or clicking on it. And to make life even easier, under the 4.0+ browsers, objects can also be named.

The importance of this structure is that it gives a consistent way of referring to objects within a document. Want to access the third form in a document? Under the DOM, that object would be referred to as document. form(2) (the numbering of objects of a specific type starts at zero).

But there's more to it than just scripting. Dynamic HTML is three technologies combined: HTML, Cascading Style Sheets (CSS) and scripting. Web documents are written in HTML, while CSS defines the style and positioning of objects.

Of course, the key players in the browser market, Microsoft and Netscape, have never agreed on what Dynamic HTML consists of. Microsoft always referred to the acronym as "DHTML"; Netscape presented it as "dHTML." After that, it got complicated.

The champion of Web standards, the World Wide Web Consortium (W3C), has a role in all this. In December 1998, the DOM Level 1 Specification became a W3C Recommendation. CSS, Level 2, became a W3C Recommendation in May 1998.

At the risk of starting a religious war, let me say the differences between the vendors' views of Dynamic HTML will become irrelevant in short order; Netscape is in limbo while Sun absorbs the carcass that was spat out by America Online. Worse still, Netscape will probably stay in that state long enough for its market share to erode beyond recovery.

In effect and by default, Microsoft has won the browser battle and Microsoft's view of Dynamic HTML is going to have the greatest impact on market direction, the U.S. Department of Justice not withstanding.

So what does this mean to you? Well, Dynamic HTML is still very new and relatively rare on the public Web. Writing Dynamic HTML content that works cross-browser is still hard work. But that hard work can have a big payoff, and even the dullest content can acquire an air of dynamism.

Dynamic responses to gearhead@ gibbs.com.

Комментариев нет:

Отправить комментарий