DOM advanced programming _ DOM

Source: Internet
Author: User
This article mainly introduces DOM advanced programming. You can refer to the three types of DOM standard interfaces (for diagrams) Core DOM (Core DOM) stipulated by W3C, which are suitable for various structured documents; xml dom (learned by Java OOP), used for XML documents; html dom, used for HTML documents. The following describes the following issues.

I. location and history objects

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

2. Application of location and history objects

The Code is as follows:


View flower details
Refresh this page
Back to homepage

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

The 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.