DOM Advanced programming
- 2020-06-07 04:00:52
- OfStack
Introduction: Three kinds of DOM standard interfaces specified by W3C (switch diagram) Core DOM (core DOM), suitable for various structured documents; XML DOM (Java OOP), for XML documents; HTML DOM, dedicated to HTML documents, here are a few questions.
1. location and history objects
back () / / return
forward()
go () / / forward
location
href / / links
reload / / loaded
2. Application of location and history objects
<a href="javascript:location.href='flower.html'"> View flower details </a>
<a href="javascript:location.reload()"> Refresh this page </a>
<a href="javascript:history.back()"> Back to main page </a>
3. Common properties of Document objects
1.referrer (return URL of the document loaded with the current document)
URL (return URL for current document) document. referrer document. URL
Common methods for Document objects
getElementById() Returns the possession of the specified pair id The first 1 A reference to an object)
getElementsByName() Returns a collection of objects with the specified name
getElementsByTagName() Returns a collection of objects with the specified tag name
write() (Write text to the document, HTML Expression or JavaScript Code)
4. Differences between the three access page elements
getElementById() is accessed by the ID name of the element
getElementsByName() is accessed by the name name of the element
getElementsByTagName() by TAB
5. Display and hide elements
1.visibility visible (indicates that the element is visible)
hidden (indicates that the element is not visible) object.style.visibility =" value"
2.display none (indicates that this element will not be displayed)
object.style.display =" value"
6. Properties of check boxes
The checked attribute value of the check box is selected: true is not selected: false