JavaScript's Document Object
Learning Essentials:
Document Object
Application of Document objects
I. Document Object
The Document object is an object that represents an HTML file that is displayed in a browser window or frame. JavaScript automatically creates a Document object for each HTML document. The Document object allows you to manipulate the content and other objects in the HTML document.
Child object of the Document object:
Anchor object, Applet object, cookie object, Embed object, form object, Image object, link object, Location object, plugin object.
Second, the application of the Document object
1. Set the color of hyperlinks
Document.linkcolor: Color of hyperlinks that have not been visited
Document.vlinkcolor: The color of hyperlinks that have been visited
Document.alinkcolor: The color of the hyperlinks being accessed
2. Set page background color and default text color
In the BODY element in HTML, you can set the page background color and default text color through the bgcolor property and the Text property.
The bgcolor property and the Fgcolor property of the Document object can also set the page background color and the default text color.
After you set the bgcolor property and the Text property in the BODY element, the HTML itself cannot modify these property values. However, it can be modified by the bgcolor property and the Fgcolor property of the Document object.
3. Image Object
The return value of the images property of the Document object is an array, and each element in the array is an image object.
Basic JavaScript Learning (13)