JavaScript Editor Free JavaScript Editor     JavaScript Debugger 




Main Page

Previous Page
Next Page

15.1. Interfaces

The HTML Document Object Model is an application programming interface (API) that defines the structure of an HTML document in the browser. In addition, it defines how that document can be accessed and manipulated through the use of JavaScript, sometimes embedded within the very same HTML document that is being manipulated.

This sounds a little scary doesn't it? The idea that a JavaScript routine could essentially modify the very fabric of its own universe can be terrifying. Just one oops, and it is overit modified itself right out of existence. For all intents and purposes, as far as the browser was concerned, it would have never existed. Fortunately, this takes a little work to accomplish, and only the JavaScript function and possibly the associated page would cease to exist. Believe me, if this wasn't the case, I would have winked out long ago.

Table 15-1 shows the various HTML Document Object Model interfaces available through JavaScript. I would like to point out that the majority of these interfaces correspond to actual HTML elements. Yes, name an HTML element, and there is a corresponding interface; remember, though, that just because an interface exists for a deprecated element, you don't have to use it. It is still deprecated.

Table 15-1. HTML Document Object Model Interfaces Available Through JavaScript

Interface Name

Description

HTMLCollection

A collection of HTML nodes

HTMLDocument

The root element of the HTML document

HTMLElement

The base class for all HTML elements

HTMLHtmlElement

Corresponds to the html element

HTMLHeadElement

Corresponds to the head element

HTMLLinkElement

Corresponds to the link element

HTMLTitleElement

Corresponds to the title element

HTMLMetaElement

Corresponds to the meta element

HTMLBaseElement

Corresponds to the base element

HTMLIsIndexElement

Corresponds to the isindex element

HTMLStyleElement

Corresponds to the style element

HTMLBodyElement

Corresponds to the body element

HTMLFormElement

Corresponds to the form element

HTMLSelectElement

Corresponds to the select element.

HTMLOptGroupElement

Corresponds to the option group element

HTMLOptionElement

Corresponds to the option element

HTMLInputElement

Corresponds to the input element

HTMLTextAreaElement

Corresponds to the text area element

HTMLButtonElement

Corresponds to the button element

HTMLLabelElement

Corresponds to the label element

HTMLFieldSetElement

Corresponds to the field set element

HTMLLegendElement

Corresponds to the legend element

HTMLUListElement

Corresponds to the unordered list element

HTMLOListElement

Corresponds to the ordered list element

HTMLDListElement

Corresponds to the dash list element

HTMLDirectoryElement

Corresponds to the directory element

HTMLMenuElement

Corresponds to the menu element

HTMLLIElement

Corresponds to the list element

HTMLBlockquoteElement

Corresponds to the block quote element

HTMLDivElement

Corresponds to the div element

HTMLParagraphElement

Corresponds to the paragraph element

HTMLHeadingElement

Corresponds to the heading elements

HTMLQuoteElement

Corresponds to the quote element

HTMLPreElement

Corresponds to the preformatted element

HTMLBRElement

Corresponds to the break element

HTMLBaseFontElement

Corresponds to the base font element

HTMLFontElement

Corresponds to the font element

HTMLHRElement

Corresponds to the horizontal rule element

HTMLModElement

Corresponds to the modification elements

HTMLAnchorElement

Corresponds to the anchor element

HTMLImageElement

Corresponds to the image element

HTMLObjectElement

Corresponds to the object element

HTMLParamElement

Corresponds to the parameter element

HTMLAppletElement

Corresponds to the applet element

HTMLMapElement

Corresponds to the map element

HTMLAreaElement

Corresponds to the area element

HTMLScriptElement

Corresponds to the script element

HTMLTableElement

Corresponds to the table element

HTMLTableCaptionElement

Corresponds to the table caption element

HTMLTableColElement

Corresponds to the table column element

HTMLTableSectionElement

Corresponds to the table section element

HTMLTableRowElement

Corresponds to the table row element

HTMLTableCellElement

Corresponds to the table cell element

HTMLFrameSetElement

Corresponds to the frame set element

HTMLFrameElement

Corresponds to the frame element

HTMLIFrameElement

Corresponds to the iframe element


15.1.1. Window

Although it's not officially part of the HTML Document Object Model, the window object is the big kahuna, the big cheese, or, in web development terms, top of the hierarchy. Many web developers don't realize it, but all HTML documents are actually children of the window object. This means that it is as valid to code window.document as it is to code document. You will probably see only the latter as opposed to the former, but I think it's a good idea to point out the possibility of the former, if only to avoid those Homer Simpson moments: Doh!


Previous Page
Next Page

http://www.cashadvance-loans.net/south-carolina/cash-advance-charleston-sc/ . Bitcoin Dice - Crypto Casino


JavaScript Editor Free JavaScript Editor     JavaScript Debugger


©