BOM operating front-end learning

window object

All browsers support the window object. It represents the browser window.

* If the document contains a frame (frame or iframe tag), the browser will create a window object as an HTML document, and create an additional window object for each frame.

* No open standards used in the window object, but all browsers support the object.

All JavaScript global object, functions, and variables are automatically members of the window object.

Global variables are window object's properties. Global function is the window object.

Then talk about the HTML DOM document window is one of the attributes of the object.

Some commonly used Window methods:

  • Internal height of the browser window - window.innerHeight
  • window.innerWidth - inside the browser window width
  • window.open () - opens a new window
  • window.close () - Close the current window

     

    pop-up windows 

  There are three pop-up box (alert box, check box, balloon)

 

 Associated with timing

setTimeout timing 

< Script > 
    function FUNC () { 
        the window.close () 

    } 
    / * window is directly related to the object browser 
    intermediate setTimeout two parameters need to fill 
    the first parameter mapping function to be executed 
    second argument how many seconds execution milliseconds 
    * / 
    var T = the setTimeout (FUNC, 3000 ); 
    the clearTimeout (T) 
    // the clearTimeout cancel the setTimeout 
</ Script > 


the setInterval timing 
< Script > 
    function F () { 
        Alert ( 123 ) 
    } 

    function F1 () {
         //setTimeout setInterval with different he is executed every several seconds 
        // setTimeout compartment but is performed once a few seconds is performed once again will not be executed 
        var T = setInterval (F, 3000 );
         function Inner () { 
            the clearInterval (T) 
        } 

        setTimeout (Inner, 9000 )} 

    F1 () 


</ Script >

 

Guess you like

Origin www.cnblogs.com/asdaa/p/11492936.html