HTML The Definitive Guide (137 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

BOOK: HTML The Definitive Guide
2.81Mb size Format: txt, pdf, ePub

9.3.8.2

width

width

9.3.6.12

JSS also defines three methods that allow you to define margins, padding, and border widths within a single style property. The three methods, margins(), paddings(), and borderWidths(), accept four parameters, corresponding to the top, right, bottom, and left margin, padding or border width, respectively. Unlike their CSS counterparts (margin, 9.3.6.10; padding, 9.3.6.11; and border-width, 9.3.6.4), these JSS methods require that you always specify all four parameters.

There is no shorthand way in JSS to set multiple margins, paddings, or border widths with a single value.

13.3 JavaScript

14. Dynamic Documents

Chapter 14
14. Dynamic Documents
Contents:

An Overview of Dynamic Documents

Client-Pull Documents

Server -Push Documents

The standard HTML document model is static. Once displayed on the browser, a document does not change until the user initiates some activity like selecting a hyperlink with the mouse.[
1
] The developers at Netscape Communications found that limitation unacceptable and built in some special features to their Netscape Navigator browser that let you change HTML document content dynamically. In fact, they provide for two different mechanisms for dynamic documents, which we describe in detail in this chapter. Internet Explorer supports some of these mechanisms, which we'll discuss as well.

[1] Of course you could embed animated GIFs or applets that dynamically update the display, but the underlying HTML document itself doesn't change.

We should mention that many of the features of dynamic documents have been displaced by plug-in browser accessories and in particular applets. Nonetheless, Netscape and Internet Explorer continue to support dynamic documents, and we believe the technology has virtues you should be aware of, if not
take advantage of, in your HTML documents. [Applets and Objects, 13.1]

14.1 An Overview of Dynamic Documents

If you remember from our discussion in Chapter 1, HTML and the World Wide Web
, the client browser initiates data flow on the Web by contacting a server with a document request. The server honors the request by downloading the document. The client subsequently displays the document's contents to the user. For normal web documents, a single transaction initiated from the client side is all that is needed to collect and display the document. Once displayed, however, it does not change.

Dynamic documents, on the other hand, are the result of multiple transactions initiated from either or both the server side and the client side. A
client-pull
document is one that initiates multiple transactions from the client side. When the server is the instigator, the dynamic document is known as a
server-push
document.

In a client-pull document, special HTML codes tell the client to periodically request and download another document from one or more servers on the network, dynamically updating the display.

Server-push documents also advance the way servers communicate with clients. Normally, over the Web, the client stays connected with a server for only as long as it takes to retrieve a single
document.[2] With server-push documents, the connection remains open and the server continues to

send data periodically to the client, adding to or replacing the previous contents.

[2] One connection per document is true even for inline images browsers may automatically download from the server. If you don't believe us, just watch the status line at the bottom of your browser while you download an HTML document with several images. You should see many "Contacting the server" and "Reading the file..." or similar messages.

Netscape is currently the only browser able to handle server-push dynamic HTML documents correctly; both Internet Explorer and Netscape support client-pull documents. With other browsers, you might see only part of the dynamic document at best. At worst, the browser will completely reject the document. Unfortunately, because dynamic documents are client-server processes, they don't work without an HTTP server. That means you can't develop and test your dynamic HTML documents stored as local files, unless you have a server running locally, as well.

14.1.1 Another Word of Caution

As always, we tell you exactly how to use these exciting but nonstandard features, and we admonish you not to use them unless you have a compelling and overriding reason to do so. We are particularly strident with that admonition for dynamic documents, not only because they aren't part of the HTML

standard, but because dynamic documents can hog the network. They require larger, longer downloads than their static counterparts. And they require many more (in the case of client-pull) or longer-term (for server-push) client-server connections. Multiple connections on a single server are limited to a few of the vast millions of web users at a time. We'd hate to see your readers miss out because you've created a jiggling image in a dynamic HTML document that would otherwise have been an effective and readily accessible static document more people could enjoy.

13.4 JavaScript Style Sheets

14.2 Client-Pull Documents

Other books

See You at Harry's by Jo Knowles
En una silla de ruedas by Carmen Lyra
Affirmation by S. W. Frank
Sidelined by Simon Henderson
My First Five Husbands by Rue McClanahan
The Second Saladin by Stephen Hunter