04.11.2015 Views

javascript

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The Document Object Model<br />

The Document Object Model (DOM) is an application programming interface (API) for HTML and<br />

XML documents. The DOM represents a document as a hierarchical tree of nodes, allowing<br />

developers to add, remove, and modify individual parts of the page. Evolving out of early<br />

Dynamic HTML (DHTML) innovations from Netscape and Microsoft, the DOM is now a truly<br />

cross - platform, language - independent way of representing and manipulating pages for markup.<br />

DOM Level 1 became a W3C recommendation in October 1998, providing interfaces for basic<br />

document structure and querying. This chapter focuses on the features and uses of DOM Level 1<br />

as it relates to HTML pages in the browser and its implementation in JavaScript. The browsers that<br />

have mostly complete implementations of DOM Level 1 are Internet Explorer (IE) 6 and later<br />

(IE 5.5 has several missing features), Firefox, Safari, Chrome, and Opera 7.5 and later.<br />

Note that all DOM objects are represented by COM objects in IE. This means that<br />

the objects don ’ t behave or function the same way as native JavaScript objects.<br />

These differences are highlighted throughout the chapter.<br />

Hierarchy of Nodes<br />

Any HTML or XML document can be represented as a hierarchy of nodes using the DOM. There<br />

are several node types, each representing different information and/or markup in the document.<br />

Each node type has different characteristics, data, and methods, and each may have relationships

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!