JavaScript BOM & DOM

Source: Internet
Author: User
Tags object model setinterval

The BOM (Browser object model) refers to the browser's objects models, which make JavaScript capable of "talking" to the browser. The DOM (Document Object model) refers to all the elements of an HTML document that can be accessed by using it.

The Window object is one of the top-level objects of the client-side JavaScript, and since the Window object is a common ancestor of most other objects, the Window object's reference can be omitted when invoking the methods and properties of the Window object. For example: Window.document.write () can be simply written as: document.write ().

Common methods:

Location

To view the URL of the current URL:

Location.href

Modify URL:

location.href= ' http://qq.com '

Refresh URL: Parentheses required

Pop-up box
var a = alert ('---warning box---'), Console.log (a), var c = confirm ('---you confirm?---'), Console.log (c), var p = prompt ('---cue box---'); Console.log (P);

Timing Correlation: Set

Do one thing after the specified time: SetTimeout ()

SetTimeout (What to do, time milliseconds)

t = setTimeout (f1= () =>{console.log (' difficult to be difficult to be moral ');},3000)

Stop this thing:

Cleartimeout (t)

Do one thing at a time: setinterval

t = setinterval (f2= () =>{console.log (' What's this ', ' n '); Console.log (' Ooxx ');},1000)

Stop this.

Clearinterval (t)

JavaScript BOM & DOM

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.