DOM advanced programming and dom Advanced Programming

Source: Internet
Author: User

DOM advanced programming and dom Advanced Programming

Three types of DOM standard interfaces (for maps) Core DOM (Core DOM) stipulated by W3C are suitable for various structured documents. xml dom (learned by Java OOP) is specialized in XML documents; html dom, which is used for HTML documents. The following are some questions.

I. location and history objects

Back () // return
Forward ()
Go () // forward
Location
Href // link
Reload // Load

2. Application of location and history objects

Copy codeThe Code is as follows:
<A href = "javascript: location.href?'flower.html '"> View flowers </a>
<A href = "javascript: location. reload ()"> refresh this page </a>
<A href = "javascript: history. back ()"> return to the home page </a>

Iii. common attributes of Document objects

1. referrer (return the URL of the document loading the current document)
2. URL (return the URL of the current document) document. referrer document. URL

Common Methods for Document objects

Copy codeThe Code is as follows:
GetElementById () (returns a reference to the first object with the specified id)
GetElementsByName () (returns a set of objects with the specified name)
GetElementsByTagName () (returns a set of objects with the specified tag name)
Write () (write text, HTML expressions, or JavaScript code to a document)

Iv. Differences between the three access page elements

GetElementById () is accessed by the element ID
GetElementsByName () is accessed by the element name
GetElementsByTagName () is accessed by tag

5. Display and hide Elements

1. visibility visible (indicating that the element is visible)

Hidden (indicating that the element is invisible) object. style. visibility = "value"

2. display none (indicating that this element will not be displayed)

Block (this element is displayed as a block-level element with a line break before and after this element) object. style. display = "value"

6. Check box attributes

Check box checked attribute value selected: true unselected: false

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.