343Chapter 18 .The Document and Body Objects served

343Chapter 18 .The Document and Body Objects served as an HTML container for forms, links, and anchors. The document object, therefore, assumed a majority of the role of the BODY element. But even then, the document object became the most convenient place to bind some properties that extend beyond the BODY element, such as the TITLE element and the URL of the link that referred the user to the page. When viewed within the context of the HTML source code, the original document object is somewhat schizophrenic. Even so, the document object has worked well as the basis for references to original object model objects, such as forms, images, and applets. This, of course, was before every HTML element, including the BODY element, was exposed as an object via modern object models. Amazingly, even with the IE4+ object model and W3C DOM both of which treat the BODY element as an object separate from the documentobject script compatibility with the original object model is quite easily accomplished. The document object has assumed a new schizophrenia, splitting its personality between the original object model and the one that places the document object at the root of the hierarchy, quite separate from the BODY element object it contains. The object knows which face to put on based on the rest of the script syntax that follows it. This means that quite often there are multiple ways to achieve the same reference. For example, you can use the following statement in all scriptable browsers to get the number of form objects in a document: document.forms.length In IE4+, you can also use document.tags[ FORM ].length And in the W3C DOM as implemented in IE5+ and NN6, you can use document.getElementsByTagName( FORM ).length The more modern versions provide generic ways of accessing elements (the tags array in IE4+ and the getElementsByTagName()method in the W3C DOM) to meet the requirements of object models that expose every HTML (and XML) element as an object. Promoting the BODY element to the ranks of exposed objects presented its own challenges to the new object model designers. The BODY element is the true owner of some properties that the original document object had to take on by default. Most properties that had belonged to the original document object were renamed in their transfer to the BODY element. For example, the original document.alinkColor property is the body.aLinkproperty in the new model. But the bgColorproperty has not been renamed. For the sake of code compatibility, the current versions of browsers recognize both properties, even though the W3C DOM (in an effort to push the development world ahead) has removed the old versions as properties of what it conceives as the document object. As confusing as all of this may sound on the surface, understanding when to refer to the original document object and when to use the new syntax doesn t take long. It all depends on what you hang off the right edge of the reference. Original properties and methods are recognized as using the original document object; new properties and methods summon the powers of the new document object. It s all quite automatic. Thankfully. document
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Leave a Reply