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