DOM & BOM: Origin, method, content, and Application

Source: Internet
Author: User

Document Object Model (Dom):Process webpage contentMethods and Interfaces

Browser Object Model (BOM):Interaction with browsersMethods and Interfaces

1. Dom is W3C standard; [common standards for all browsers]
2. Bom is used by various browser vendors according to Dom
Implementation on the respective browsers; [different definitions are displayed in different browsers, with different implementation methods]
3. Window is a BOM object, not a JS object;

Dom (Document Object Model) is an application interface (API) for HTML and XML ).

Bom mainly processes browser windows and frameworks. However, browser-specific JavaScript extensions are usually considered part of BOM. These extensions include:

A new browser window is displayed.

Move and close the browser window and resize the window

Locating objects with detailed web browser Information

Screen Object that provides detailed information about the user's screen resolution

Cookie support

IE extends BOM and adds the activexobject class. ActiveX objects can be instantiated through JavaScript.

Javacsript accesses, controls, and modifies the client (browser) by accessing the browser object model object. Because the BOM window contains the document, the properties and methods of the window object can be directly used and perceived. Therefore, you can directly use the document attribute of the window object, the document attribute allows you to access, retrieve, and modify the content and structure of XHTML documents. Because the document object is the root node of the DOM (Document Object Model) model. It can be said that BOM contains dom (object). The browser provides the BOM object for access, and then accesses the DOM object from the BOM object, thus, JS can operate the documents read by browsers and browsers. Where
Dom includes: Window

Window objects include attributes: Document, location, Navigator, screen, history, and frames.

The document root node contains subnodes: forms, location, anchors, images, and links.

The most fundamental object of Dom is the sub-object of the window object of BOM.

Differences: Dom describes the methods and interfaces for processing web content. Bom describes the methods and interfaces for interacting with browsers.

Dom defines an htmldocument and htmlelement as the basis for this implementation, that isTo operate the HTML content programmatically(For example, adding some elements, modifying the content of elements, and deleting some elements), we regard this HTML as an object tree (DOM tree ), it and everything in it, such as <div> </div>, are regarded as an object, and each object is called a node ), nodes can be understood as the parent class of all objects in the Dom.

BOM

Bom is the browser object model, which is the browser object model.

As mentioned earlier, Dom is used to operate the interface that appears in the document. The BOM is actuallyTo control browser behaviorThe interface that appears.

What can a browser do? For example, to jump to another page, forward, back, and so on, the program may also need to obtain parameters such as the screen size.

Therefore, Bom is the interface to solve these problems. For example, to redirect a browser to another page, you only need

Location. href = "http://www.xxxx.com ";


This location is an object in Bom.

Window

Window is also an object of BOM. Apart from the "full-disclosure object" in programming sense, this object can be used to obtain the window position, determine the window size, and pop-up dialog boxes. For example, to close the current window:

Window. Close ();

Dom is an API used to operate a document. Document is an object of this document;
Bom is used to operate the APIs that appear in the browser, and window is an object of it.

DOM & BOM: Origin, method, content, and Application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.