== JavaScript Document Object Methods and Properties ==
The JavaScript Document contains a wide range of methods and properties that are of considerable use to developers. The following table lists the key methods and properties provided by the Document object:
=== Document Object Methods ===
<td>fgColor<td>The foreground color (i.e. the color of the text in the document)</td>
<tr>
<td>cookie<td>The cookie, if aanyany, assosiated associated with the document. See [[Understanding JavaScript Cookies]]</td>
<tr>
<td>domain<td>The current domain of the document</td>
<td>referrer<td>The URL of the document from which the current document was linked (i.e. how the visitor arrived at this page)</td>
<tr>
<td>title<td>The title of the docuemnt document (corresponds to the HTML ''<title>'' tag)</td>
<tr>
<td>URL<td>The URL of the current document</td>
== Using the JavaScript Document Object ==
Now that we have seen the methods and properties that are avialable available with the Document object we can begin explore how to use them:
=== Writing text to a document ===
The document object ''open()'' and ''write()'' methods can be used to dynamically write text to a web page. The following example contains both some text contained in the HTML file, togetehr together with some JavaScript to write additional text into the page:
<pre>
=== Writing Text to a document in a different Window ===
Exception encountered, of type "Error"
[eb45f645] /index.php/Special:MobileDiff/7286 Error from line 434 of /var/www/techotopia/includes/diff/DairikiDiff.php: Call to undefined function each()
Backtrace:
#0 /var/www/techotopia/includes/diff/DairikiDiff.php(544): DiffEngine->diag()
#1 /var/www/techotopia/includes/diff/DairikiDiff.php(344): DiffEngine->compareSeq()
#2 /var/www/techotopia/includes/diff/DairikiDiff.php(227): DiffEngine->diffLocal()
#3 /var/www/techotopia/includes/diff/DairikiDiff.php(721): DiffEngine->diff()
#4 /var/www/techotopia/includes/diff/DairikiDiff.php(859): Diff->__construct()
#5 /var/www/techotopia/includes/diff/DairikiDiff.php(980): MappedDiff->__construct()
#6 /var/www/techotopia/extensions/MobileFrontend/includes/diff/InlineDiffFormatter.php(99): WordLevelDiff->__construct()
#7 /var/www/techotopia/includes/diff/DiffFormatter.php(140): InlineDiffFormatter->changed()
#8 /var/www/techotopia/includes/diff/DiffFormatter.php(82): DiffFormatter->block()
#9 /var/www/techotopia/extensions/MobileFrontend/includes/diff/InlineDifferenceEngine.php(117): DiffFormatter->format()
#10 /var/www/techotopia/includes/diff/DifferenceEngine.php(797): InlineDifferenceEngine->generateTextDiffBody()
#11 /var/www/techotopia/includes/diff/DifferenceEngine.php(728): DifferenceEngine->generateContentDiffBody()
#12 /var/www/techotopia/extensions/MobileFrontend/includes/specials/SpecialMobileDiff.php(241): DifferenceEngine->getDiffBody()
#13 /var/www/techotopia/extensions/MobileFrontend/includes/specials/SpecialMobileDiff.php(135): SpecialMobileDiff->showDiff()
#14 /var/www/techotopia/extensions/MobileFrontend/includes/specials/MobileSpecialPage.php(53): SpecialMobileDiff->executeWhenAvailable()
#15 /var/www/techotopia/includes/specialpage/SpecialPage.php(384): MobileSpecialPage->execute()
#16 /var/www/techotopia/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run()
#17 /var/www/techotopia/includes/MediaWiki.php(281): SpecialPageFactory::executePath()
#18 /var/www/techotopia/includes/MediaWiki.php(714): MediaWiki->performRequest()
#19 /var/www/techotopia/includes/MediaWiki.php(508): MediaWiki->main()
#20 /var/www/techotopia/index.php(41): MediaWiki->run()
#21 {main}