The BOM (Browser object mode) browser objects model is an important part of JavaScript. It provides a series of objects that are used to interact with browser windows, which are commonly referred to as BOMs.
A picture to understand the first
1. Window Object--bom Core
Window object, as the name implies. It represents the entire browser window and is used primarily to manipulate the browser window. At the same time, the Window object is also a global object in ECMAScript, so all global variables and functions are its properties, and all native constructors and other functions exist under its namespace.
The method of the Bullet box class. Omit window in front
Alert (' Hint message ')
Confirm ("Confirmation information")
Prompt ("Popup input Box")
Open ("URL address", "_black or _self", "Size of new Window")
Close () Closes the current page
Timer, clear the timer.
SetTimeout (function, time) executes only once
Cleartimeout (timer name) clears the timer to stop executing the function code of the SetTimeout () method.
SetInterval (function, time) infinite execution
The Clearinterval () method is used to stop the function code executed by the SetInterval () method.
Cookies are used to store user information for Web pages.
JavaScript can use the document.cookie property to create, read, and delete cookies. Document.cookie will return all cookies in a string, type format: Cookie1=value; Cookie2=value; Cookie3=value;
2. Document Object
It is a property of the Window object that can be used to process the page document
3. Location Object
object is used to obtain the address (URL) of the current page and redirect the browser to a new page.
The window.location object can be written without using the window prefix. Some examples:
location.herf = ' URL address '
Location.hostname returns the domain name of the web host
Location.pathname returns the path and file name of the current page
Location.port returns the port of the web host (80 or 443)
Location.portocol returns the Web protocol used by the page. http: or https:
4. Navigator Object
object provides browser-related information. UserAgent is the most commonly used property to complete the browser's judgment.
The window.navigator object can be written without using the window prefix.
5. Screen Object
Mainly used to get the user's screen information.
The window.screen object can be written without using the window prefix
Height: Gets the height of the entire screen.
Width: Gets the width of the entire screen.
Availheight: High of the entire screen minus the height of the system part (available screen width)
Availwidth: The width of the entire screen minus the width of the system part (available screen height)
6. History Object
object contains the history of the browser.
The window.history object can be written without using the window prefix.
Back () returns to the previous page.
Forward () returns to the next page.
Go ("Parameters")-1 represents the previous page, and 1 represents the next page.
JS Basics---Common BOM objects