Javascript--bom (Browser object model), time interval and pause

Source: Internet
Author: User

BOM (Browser object model): Browser windows can be accessed and manipulated
1, the basic BOM system:
Window------------Document------------------------------------------anchors
| |
--frames ----Forms
| |
--history ----Images
| |
--location (browser address)----Links
| |
--navigator (Get browser information)----location
|
--screen (screen)
2. Screen object: Access by Window.screen property
(1), availheight/availwidth (returns the inner height/width of the screen, and does not vary with the size of the window relative to the hardware)
(2), height/width return screen hardware requirements are high, can not be changed
(3) pixeldepth display screen color resolution (bit per pixel)
3. Location object: Access by Window.location property
(1) Hash set or return the URL (anchor) starting with the pound sign (#).
(2) host sets or returns the hostname and port number of the current URL.
(3) hostname Sets or returns the host name of the current URL.
(4) HREF Sets or returns the full URL.
(5) Pathname Sets or returns the path portion of the current URL.
(6) port Sets or returns the port number of the current URL.
(7) protocol sets or returns the protocol for the current URL.
(8) Search Sets or returns the URL (query section) starting with the question mark (?).
(9) Assign () loading a new document
Replace () replaces the current document with a new document
such as: Window.location.replace ("http://www.w3school.com.cn")
(one) reload () reload the current document
4. History object: Access by Window.history property
(1) Length: Returns the number of URLs in the browser history list
such as: document.write (history.length);
(2) Back () load the previous URL in the history list
(3) Forward () load the next URL in the history list
(4) Go () Load a specific page in the history list
5. Navigator object:
(1) A string representation of the appCodeName browser code name (e.g. "Mozilla")
(2) string representation of AppName official browser name
(3) appMinorVersion string representation of additional version information
6. Time interval and pause
Pause: Executes the specified code after the specified number of milliseconds, and the interval is repeated execution of the specified code, waiting for a specified number of milliseconds between each execution
Set a pause with the settimeout () method of the Window object, accept two parameters, the code to execute, and the number of milliseconds to wait before executing it, toTo refer to a previously defined function, such as settimeout (func,1000), meaning to execute the Func function after 1 seconds

The difference between SetTimeout and setinterval:

The SetTimeout method is a timed procedure, that is, what to do after what time. It's finished.
The SetInterval method is to represent the interval for a certain amount of time to perform an operation repeatedly.
JS Set delay:
Using setinterval and setting the delay function settimeout very similar. SetTimeout used to delay a period of time before doing an operation.
SetTimeout ("function", time) sets a timeout object
SetInterval ("function", time) sets a timeout object
SetInterval for automatic repetition, settimeout does not repeat.
Cleartimeout (object) clears the SetTimeout object that has been set
Clearinterval (object) clears the SetInterval object that has been set


Javascript--bom (Browser object model), time interval and pause

Related Article

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.