Home >Web Front-end >JS Tutorial >DOM Advanced Programming_DOM

DOM Advanced Programming_DOM

WBOY
WBOYOriginal
2016-05-16 16:00:271093browse

Foreword: Three types of DOM standard interfaces (image changing) stipulated by W3C: Core DOM (core DOM), suitable for various structured documents; XML DOM (learned in Java OOP), dedicated to XML documents; HTML DOM, dedicated For HTML documents, let’s understand the following questions.

1. Location and history objects

back() //Return
forward()
go() //Forward
location
href //Link
reload //Load

2. Application of location and history objects

Copy code The code is as follows:

3. Common properties of Document object

1.referrer (returns the URL of the document that loads the current document)
2.URL (returns the URL of the current document) document.referrer document.URL

Common methods of Document object

Copy code The code is as follows:

getElementById() (returns a reference to the first object with the specified id)
getElementsByName() (returns a collection of objects with the specified name)
getElementsByTagName() (returns a collection of objects with the specified tag name)
write() (write text, HTML expression or JavaScript code to the document)

Four. The differences between the three access page elements

getElementById() accesses the element by its ID name
getElementsByName() accesses elements by their name
getElementsByTagName() access by tag

5. Displaying and hiding elements

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

hidden (indicates that the element is invisible) object.style.visibility="value"

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

block (indicates that this element will be displayed as a block-level element, with line breaks before and after this element) object.style.display="value"

6. Attributes of check boxes

Checked attribute value of the check box Checked: true Unchecked: false

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn