Javascript Reference
Categories: document

javascript document Description

@March 15, 2008, 1:22 a.m.
document Firefox/Netscape/NN 2 IE 3 Chrome/Safari/DOM 1

The document object represents both the content viewed in the browser window or frame and the other content of the HTML file loaded into the window or frame. Thus, all information from the head portion of the file is also part of the document object. All references to elements must include a reference to the document object. The document object has no name other than its hard-wired object name: document.

 

For a browser with internal architecture based closely on the W3C DOM, this document object represents the HTMLDocument objecta special kind (internal subclass) of the core module's Document object, suited to holding HTML documents. In other words, the HTMLDocument object inherits the properties and methods of the core Document object (sharing facilities with XML documents) and gets additional properties and methods that apply only to HTML documents. Of course, there is the conceptual incongruity about whether an HTMLDocument is applicable to an XHTML document because such a document theoretically is an XML document. But, in practice, even an XHTML document becomes an HTML document for scripting purposes, and has all the HTMLDocument properties and methods available to it.

 

One more important practical side to a W3C DOM implementation (as evidenced by the Netscape 6 implementation) is that the document object internally implements document-level properties and methods from other DOM modules, such as views, events, and styles. Each of these modules defines an object (DocumentEvent, DocumentRange, DocumentStyle, and DocumentView) that provides a vital connection between the HTMLDocument and these add-on module features. Thus, it is the styleSheets property of the DocumentStyle object in the W3C DOM that the scriptable document object described here uses to reach the styleSheet objects and their rules. And the DocumentEvent object links in its createEvent( ) method that allows the scriptable document object to generate an event outside the normal user- or system-created events. All of these features become subsumed by the document object you reference and script in Netscape 6 and similar browsers. The precise source module for a particular feature is not important to the scripterall you need to know is that the properties and methods belong to the scriptable document object.

 
Object Model Reference
 
[window.]document
 
Object-Specific Properties
 
activeElement alinkColor anchors[ ] applets[ ]
bgColor body charset characterSet
compatMode cookie defaultCharset defaultView
doctype documentElement domain embeds[ ]
expando fgColor fileCreatedDate fileModifiedDate
fileSize fileUpdatedDate forms[ ] frames[ ]
height ids[ ] images[ ] implementation
lastModified layers[ ] linkColor links[ ]
location media mimeType nameProp
namespaces[ ] parentWindow plugins[ ] protocol
readyState referrer scripts[ ] security
selection styleSheets[ ] tags[ ] title
URL URLUnencoded vlinkColor width
 
Object-Specific Methods
 
addBinding( ) captureEvents( )
clear( ) close( )
createAttribute( ) createAttributeNS( )
createCDATASection( ) createComment( )
createDocumentFragment( ) createElement( )
createElementNS( ) createEntityReference( )
createEvent( ) createEventObject( )
createNodeIterator( ) createProcessingInstruction( )
createRange( ) createStyleSheet( )
createTextNode( ) createTreeWalker( )
elementFromPoint( ) execCommand( )
getAnonymousElementByAttribute( ) getAnonymousNodes( )
getBindingParent( ) getElementById( )
getElementsByName( ) getSelection( )
handleEvent[ ] hasFocus( )
importNode( ) loadBindingDocument( )
open( ) queryCommandEnabled( )
queryCommandIndeterm( ) queryCommandState( )
queryCommandSupported( ) queryCommandText( )
queryCommandValue( ) recalc( )
releaseEvents( ) removeBinding( )
routeEvent( ) write( )
writeln( )
 
Object-Specific Event Handler Properties
 
Handler Firefox/Netscape/NN IE Chrome/Safari/DOM
onselectionchange n/a 4 n/a
onstop n/a 4 n/a

Powered by Linode.