Sie sind auf Seite 1von 3

Document Object

The Document object represents the entire HTML


document and can be used to access all elements in a
page.

The Document object is part of the Window object and


is accessed through the window.document property.

IE: Internet Explorer, F: Firefox, O: Opera, W3C: World


Wide Web Consortium (Internet Standard).

Document Object Collections


Collection Description IEF O W3C
anchors[] Returns a reference to all 4 1 9 Yes
Anchor objects in the
document
forms[] Returns a reference to all 4 1 9 Yes
Form objects in the
document
images[] Returns a reference to all 4 1 9 Yes
Image objects in the
document
links[] Returns a reference to all 4 1 9 Yes
Area and Link objects in
the document

Document Object Properties


Property Description IEF O W3C
body Gives direct access to the
<body> element
cookie Sets or returns all cookies 4 1 9 Yes
associated with the current
document
domain Returns the domain name 4 1 9 Yes
for the current document
lastModified Returns the date and time 4 1 NoNo
a document was last
modified
referrer Returns the URL of the 4 1 9 Yes
document that loaded the
current document
title Returns the title of the 4 1 9 Yes
current document
URL Returns the URL of the 4 1 9 Yes
current document

Document Object Methods


Method Description IEFOW3C
close() Closes an output 4 19 Yes
stream opened with the
document.open()
method, and displays
the collected data
getElementById() Returns a reference to 5 19 Yes
the first object with the
specified id
getElementsByName() Returns a collection of 5 19 Yes
objects with the
specified name
getElementsByTagName() Returns a collection of 5 19 Yes
objects with the
specified tagname
open() Opens a stream to 4 19 Yes
collect the output from
any document.write()
or document.writeln()
methods
write() Writes HTML 4 19 Yes
expressions or
JavaScript code to a
document
writeln() Identical to the write() 4 19 Yes
method, with the
addition of writing a
new line character after
each expression

Das könnte Ihnen auch gefallen