JavaScript Learning--bom Objects

Source: Internet
Author: User

1. BOM object: Browser object model (manipulating browser-related content)

2. Window Object

Window object represents open windows in the browser

SetInterval (): It has a return value that is primarily provided to clearinterval using

SetTimeout (): It has a return value that is primarily provided to cleartimeout using

Clearinterval (): This method can only clear timed actions set by setinterval

Cleartimeout (): This method can only clear timed actions set by SetTimeout

A few ways to pop up a box:

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4         <MetaCharSet= "UTF-8">5         <title>Window object</title>6         <Script>7             //Warning Box8 Alert ("ah ha! ");9             //Confirm Delete BoxTen Confirm ("are you sure you want to delete it? "); One             //Input Box A Prompt ("Please enter the price"); -         </Script> -     </Head> the     <Body> -     </Body> - </HTML>

3. History Object

The History object contains the URLs that the user has visited (in a browser window)

Before executing this code, there should be a history page, which can be a hyperlink to this page.

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4         <MetaCharSet= "UTF-8">5         <title>History Object</title>6         <Script>7             functionFanhui () {8 History.go (-1);9                 //History.back ();Ten             } One         </Script> A     </Head> -     <Body> -         <inputtype= "button"value= "Back to previous page"onclick= "Fanhui ()" /> the     </Body> - </HTML>

Go (parameters)

Parameters: 1 Returns the previous history page, 2 returns to the previous history page, and 1 goes to the next history page.

3. Location Object

The Location object contains information about the current URL.

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4         <MetaCharSet= "UTF-8">5         <title>Location Object</title>6     </Head>7     <Body>8         <inputtype= "button"value= "Jump to History page"onclick= "javascript:location.href= ' 02_history object. html '"/>9     </Body>Ten </HTML>

JavaScript Learning--bom objects

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.