CHAPTER 15 Scripting Documents
Chapters 13 and 14 explained that every web browser window, tab, and frame is represented by a Window object. Every Window object has a documentproperty that refers to a Document object. The Document object represents the content of the window, and it is the subject of this chapter. The Document object does not stand alone, however. It is the central object in a larger API, known as the Document Object Model, or DOM, for representing and manipulating document content.
This chapter begins by explaining the basic architecture of the DOM. It then moves on to explain:
- How to query or select individual elements from a document.
- How to traverse a document as a tree of nodes, and how to find the ancestors, siblings, and descendants of any document element.
- How to query and set the attributes of document elements.
- How to query, set, and modify the content of a document.
- How to modify the structure of a document by creating, inserting, and deleting nodes.
- How to work with HTML forms.
The final section of the chapter covers miscellaneous document features, including the referrer property, the write() method, and techniques for querying the currently selected document text.欢迎转载,转载请注明来自一手册:http://yishouce.com/book/1/27714.html