JavaScript Browser Object

Source: Internet
Author: User

Window object

1. Window Object

The Window object is the core of the bom, and the Window object refers to the current browser window

All JS global objects, functions, and variables automatically become members of the Window object

A global variable is a property of a Window object

A global function is a method of a Window object

Even document in the HTML DOM is one of the properties of the Window object

2. Window size (does not include toolbars and scroll Bars)

Window.innerheight the internal height of the browser window

window.innerwidth The interior width of the browser window

3. Window method:

Window.Open () opens a new window Window.close () close the current window

Timer

1. Timing Events: by using javascript, we have the ability to execute code after a set Interval. Instead of executing immediately after the function is called, we call it a timing event.

2, timing method: SetInterval () interval Specifies the number of milliseconds to execute the specified code clearinterval () stop setinterval () method to execute the function code

SetTimeout () suspends the specified number of milliseconds after execution of the specified code cleartimeout () stops execution of the setTimeout () Method's function code (self-tuning to loop down )

History Object

1. History Object: The Window.history object contains a collection of browser histories (urls)

2. History method: History.back () Same as clicking the Back button in the browser

History.forward () the same as clicking the Forward button in the browser

History.go () go to a page in history

Location Object

1. Location Object: Window.location object is used to get the address (URL) of the current page, and to relocate the browser to a new page

2. Properties of the location object:

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

Location.protocol returns the Web protocol used (http/| | | Https://)

The Location.herf property returns the URL of the current page

Location.assign () loading a new document

Screen Object

1. Screen object: Window.screen object contains information about user screens

2. Properties: screen.availwidth Available screen width

Screen.availheight the available screen height

Screen. Height screen Altitude

Screen. Width screen widths

JavaScript Browser Object

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.