Level 0 DOM: attributes and methods of Document objects

Source: Internet
Author: User

A Document Object Model or DOM is an API that defines how to access the objects that constitute a document. W3C defines a standard DOM. Before that, when Netscape browser was a leading browser vendor, Netscape2 and Netscape3 supported a simple DOM, it only provides access to special document elements such as links, images, and forms.

BKJIA recommended reading: JavaScript DOM features and application details

This legacy DOM has been adopted by all browser vendors and has been formally incorporated into W3C standards as a "0 level" DOM. The legacy DOM is still valid in all browsers.

Why do we need to know "level 0 DOM"

"Level 0 DOM" is out of date, and the W3C defined DOM standard has a good way to achieve the same effect:

1. It actually exists and is still valid in all browsers. And sometimes it is better.

2. More methods will cause confusion. If you don't want to be confused, you can understand it and distinguish it clearly.

One sentence

"Level 0 DOM" is actually the attributes and methods of some Document objects defined.

Attributes and methods of the Document Object

First, the documentobject can be obtained by using the upload extension Doc ument, because it is the property of the window object. You can write the document directly because the window object is a global object.

Method

1. document. write () writes HTML expressions or JavaScript code to the document.

2. document. writeln () is equivalent to the write () method. The difference is that a line break is written after each expression.

3. document. open () open the document to collect the output from any document. write () or document. writeln () method.

4. document. close (). As you must close the document after writing the preceding content, note that window. close () is not mentioned here.

Attribute

1. document. bgColor is actually the bgcolor attribute of the corresponding tag <body> ).

2. document. cookie: set or return all cookies related to the current document.

3. For security restrictions of same-origin policy in document. domain, the domain name of the current document is returned.

4. document. lastModified: a string that contains the document modification date.

5. document. location is equivalent to a URL that is no longer used.

6. document. referrer: the URL of the link from which the browser is taken to the current page.

7. document. title: the title of the current document.

8. The document. URL returns the URL of the current document.

Attribute in array form

1. A set of anchors in document. anchors.

2. A collection of small applications in the document. applets.

3. A set of forms in document. forms.

4. A collection of images in document. images.

5. The collection links in document. links [] include <a href = "#"> and <area>.

Summary

For "level 0 DOM", remember the following words:

1. "level 0 DOM" does not change the document structure. You can only add a new <option> label for the <select> label.

2. If there is a <form name = "f1"> </form>, You can reference it in three formats. 1. document. forms [0]. Document. forms. f1. Three types are: document. forms ["f1"].

3. If the two elements have the same sub-name "n", the document. n will be an array that stores the references of the two elements.

Link: http://hi.baidu.com/howlking/blog/item/cb75d6b4e2e146748bd4b240.html

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.