Document object_basic knowledge in JavaScript

Source: Internet
Author: User
The Document Object in JavaScript Document object is an attribute of the window and frames objects in JavaScript. It is a Document displayed in a window or framework. This document describes the current window or the specified window object. It contains documents fromTo.
Usage: document (current window) or <窗口对象> . Document (specified window)

Attribute:



Document. title // set the document title is equivalent Tag <br> document. bgColor // set the page background color <br> document. fgColor // set the foreground color (text color) <br> document. linkColor // The link color that has not been clicked <br> document. alinkColor // the color of the activation Link (focus on this link) <br> document. vlinkColor // the color of the clicked link <br> document. URL // set URL properties to open another webpage in the same window <br> document. fileCreatedDate // file creation date, read-only attribute <br> document. fileModifiedDate // file modification date, read-only attribute <br> document. fileSize // file size, read-only attribute <br> document. cook Ie // set and read cookies <br> document. charset // set the character set to simplified Chinese: gb2312 <br> for cookie information, see "use framework and Cookies. <Br> lastModified: The last modification Date of the current document, which is a Date object. <Br> referrer: if the current document is opened by clicking the link, the referrer returns the original URL. <Br> title indicates <pead> marked with <title>...Defined text. In Netscape, this attribute is not assigned a value.

FgColor indicatesThe text color of the marked text attribute.

BgColor indicatesThe background color indicated by the bgcolor attribute.

LinkColor indicatesThe connection color of the link property.

AlinkColor indicatesThe active connection color of the alink attribute.

VlinkColorThe accessed connection color indicated by the marked vlink property.



Method:



Open () open the document so that JavaScript can write data to the current location of the document (the location where JavaScript is inserted. This method is usually not required and automatically called by JavaScript when necessary.

Write (); writeln () writes data to the document. The written data is treated as standard document HTML. The difference between writeln () and write () Is that writeln () adds a line break after data is written. This line feed is only a line feed in HTML. Whether it can be a line feed displayed depends on the position where JavaScript is inserted. For example
Insert in the tag. This line feed will also be reflected in the document.

Clear () clears the current document.

Close () closes the document and stops writing data. If the write [ln] () or clear () method is used, you must use the close () method to ensure that the changes can be displayed. If the document has not been fully read, that is, JavaScript is inserted in the document, you do not need to use this method.



Now we have enough knowledge to do the pop-up update notifications for many of the following websites.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.