JS Study Notes-BOM window

Source: Internet
Author: User

BOM: BrowserObjectModel: browser object model. It provides objects for various browser operations in JS. It is the only part of JS applications that do not have relevant standards. This problem often occurs when BOM is located, it is mainly used to process browser windows and frameworks. JS extensions specific to browsers are also considered part of BOM by default, and the public objects between browsers become the default standard. This article mainly introduces window objects.


<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Authorization + CjxwPiAgICAgICDKwL3nyc + authorization + 1wdDNqNPDtcS21M/authorization + zqqjujxpbWcgc3JjPQ = "http://www.2cto.com/uploadfile/Collfiles/20140609/20140609091503375.jpg" hspace = "50" alt = "\">

Window has six attributes, and they are also objects:

Document mainly deals with webpage documents loaded on the web;

Frames is an array of Window Frame Objects;

History stores users' online records;

Location provides information about the loaded documents and controls page jumps;

Navigator object stores the browser name and version information;

Screen displays information about the screen.

There are also several important attribute objects under the document Object attribute. The structure of the objects that operate on documents with document as the core is the DOM that everyone is familiar with. From this point of view, DOM is actually a subset of BOM.

In addition to providing its six object attributes, the window object also has some basic attributes for setting browser information, mainly as follows:



We often need the location and size information of the browser in the past. Because BOM does not have a unified standard, different attributes are implemented for different browsers. At this time, we need to perform cross-browser compatibility operations, this allows different browsers to obtain object data.

You can use the typeof attribute to determine whether the browser supports the corresponding attributes. Using different measures is a good way to perform compatibility operations. In the future, you can apply the rules based on specific situations.

Methods The window object provides the following main methods:


The figure shows a simple classification of methods. Each method is further divided into parameters, and the return values vary according to their respective situations. The method name is no exception. If you see the names of these methods, the actual function is estimated to be half done.

The window object also provides other methods: focus ()/blur (), close () corresponding to open (), scroll () to the specified pixel position, print () /find () calls up the Print dialog box and the Search dialog box respectively.

Summary

BOM is actually a set of objects, while window is the core of this set of objects. After learning about it, you can understand the structure and function of the entire browser object model.

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.