Common BOM objects (properties, methods) in JavaScript

Source: Internet
Author: User

  1. Window object
    1. Defined:
      1. A browser window instance
      2. Window-related information (Application programming Interface)
      3. Global objects specified by ECMAScript
    2. Method
      1. Open (URL), which returns an identifier reference to the window that is about to open. ( the Close method of the referenced object is called to close the window )
      2. Intermittent Call setinterval(function,time). clearinterval ()

      3. Timeout Call setTimeout(function,time); indicates how long after the code is injected into the message queue (if the queue is empty then it executes immediately, otherwise wait for the previous code to execute before executing) cleartimeout()

      4. System dialog box

        1. Alert (String)

        2. Confirm(text indicating the hint); return true/false

        3. Prompt (prompt text message, type the text in advance); returns the input information or null

  2. Location Object
    1. Defined:
      1. Holds information about the current document.

      2. will be URLs are parsed into separate fragments for easy access by developers.

      3. window.location = = = Document.location

    2. Method

      1. Location.assign(new URL), opens a new URL, and creates a new record in the record

      2. Location.reload(true/false): Refreshes the current page .

      3. Location.replace(URL): Replaces the URLof the current record with the incoming URL , and does not create a new record in the record.

      4. window.location = new URL,location.href = new URL and location.assign(new URL) effect

    3. Properties
      1. href: full URL

      2. Host: Hosts or domain names

      3. Hostname: Returns the host or domain name without a port number.

      4. Pathname: returns the directory and file name in the URL.

      5. Hash: returns the hash value (' #target ')

      6. Search: Returns the query string ('? name=fafa&sex= "Mae")

  3. History Object
    1. Definition: Stores the history of the user's Internet access.

    2. Method:

      1. Go (digital)
        1. Number: number -1 page back one record,+1 forward a record 
      2. Back (): Rewind a record
      3. Forward (): forward a record

Common BOM objects (properties, methods) in JavaScript

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.