Данный раздел предоставляет базовую информацию о DOM и содержит множество примеров работы с ним.

Что такое  DOM?

The Document Object Model (DOM) - a programmable interface for HTML and XML documents. It provides a structured representation of the document, and it also determines the way in which the structure can be accessed from the program, so that she could change the structure of the document, the style and content. DOM provides a representation of the document as a structured group of nodes and objects that have properties and methods. Essentially, it connects web pages to scripts or programming languages.

Web page - this document. This document can be displayed in the browser window or HTML-source text. But in both cases it is a document. The Document Object Model (DOM) provides another way to view, save and manipulate the document. DOM - is fully object-oriented representation of the web page, and it can change the scripting language such as JavaScript.

Standard W3C DOM forms the basis of the object model DOM, implemented in most modern browsers. Many browsers offer extensions beyond the standard W3C, so these must be tested on the Internet, where the documents can be accessed from a variety of different browsers the DOM.

For example, W3C DOM specifies that the method getElementsByTagName in the code below should return spisrk all elements of  <P> in the document:

Paragraphs = document.getElementsByTagName ("P");
// Paragraphs [0] - the first <p> element
// paragraphs [1] - the second <p> element
alert (paragraphs [0] .nodeName);

All the properties, methods and events are available for manipulating and creating web pages are organized into objects (for example,  document object that represents the document itself, table   object, which includes a special HTMLTableElement -DOM interface to access an HTML table, and so on) . This documentation provides referential integrity (?) From object to object in the browser based on Gecko.

The above example, like almost all the examples in this article - have JavaScript . This means that it is written  in JavaScript, but it uses the DOM to access the document and its elements. DOM is not a programming language, but without the JavaScript language would have no model or representation of a Web page, XML pages and that it usually affects. Each element in the document - the document as a whole, a title, a table in the document table header text in table cells - is part of the document object model for this document, thus they can be accessed and manipulated izpolzuya DOM and scripting language like JavaScript.

Метки документа и участники

 Внесли вклад в эту страницу: pachareal, arunpandianp, ethertank, shaman
 Обновлялась последний раз: pachareal,