|
|
|
|
|
|
|
Chapter 7: Working with Documents
The document object controls the HTML document that is currently loaded in the browser. This chapter explores the document object and the various objects that it, in turn, contains. Displaying text The write method is used to display text in the current document. Page 71. Displaying HTML The write method can also be used to display HTML, giving you better control over the appearance of your pages. Page 72. Working with document attributes: The Magic EightBall Document object attributes can be used to modify such things as the document's foreground color, background color, and more. This example simulates the "Magic EightBall". Pages 73-74. Showing the date last modified The document object's lastModified property contains the date and time that the current page was last modified. This version is considerably simpler than the one in the book because of Microsoft's addition of the MonthName function when VBScript 3.0 was released. Pages 75-77. Using the location property The location property is used to determine the physical location of the current document. This example had to be scaled back considerably because of changes to the Dynamic HTML (DHTML) Document Object Model (DOM) in IE 5.0: The frames object no longer supports a count property. Page 78. Creating Back and Forward buttons The history object's back and forward methods can be used to mimic the Back and Forward navigational functionality of the Web browser. Page 79. Getting the current document title You can dynamically read the text contained in the browser title bar using the document object's title property. Page 80. Creating a navigational toolbar with the href property As an alternate to the frames-based method shown in Chapter 6, this example shows a navigational toolbar that uses the location object's href property. Page 81. Using the Anchors property The anchors property is used to access the list of HTML anchors (URLs and bookmarks) that exist in the current document. Page 82. Creating a dynamic table of contents with the Open and Close methods The open and close methods of the document object can be used to create a dynamic table of contents for a page that uses anchors. Pages 83-85. |
|
|
| All content © 1997-1999 Paul Thurrott |