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