JavaScript--BOM

BOM ——browser object model
- window objects: window object, the global object
- global variables is equivalent to window properties, functions globally declared method is equivalent to the window
- Operating window
    - Open (URL, target, characteristic window) open window 
        `` ` 
            mywin = Open ( ' l- jingdong search bar .html ' , ' _blank ' , ' width = 500, height = 400 ' ); 
        ` ``

     - Close ( ) Close 

        `` ` 
            mywin.close ()   // Close the specified window 
            Close ()   // Close the current window 
        ` ``
     - the resizeTo (X-Number, Y- Number); changing the window size 
        `` ` 
            mywin.resizeTo ( 1000 , 600 ); 
        `` `
     - the moveTo (Number-X, Y-Number); change the window position 
        ` 
        mywin.moveTo ( 200 is , 300 ); 200 is displaced from the left side of the parent window, the displacement of the edge 300 from the parent window 
        `

window size

  • window.innerWidth visible region width (Developer Tools not included)
  •  window.innerHeight highly visible area (does not contain the address bar and tabs)
  •  window.outerWidth visible region width (tool comprising a Developer)
  • window.outerHeight highly visible area (including the address bar and tabs)

The location object

http://www.ujiuye.com/user/login.html?username=aaa&pass=123#a

    - location.protocol agreement   ' HTTP: '

    - location.host host and port  ' 127.0.0.1:5500 '
    - location.hostname hostname  ' 127.0.0.1 '
    - location.port port number  ' 5500 '
    - location.pathname folder and file name
    - location.search query string
    - location.hash hash value
    - location.href get or set the entire url
   

the navigator object
    - navigator.appCodeName browser code
    - navigator.appName browser name
    - navigator.appVersion browser version
    - navigator.cookieEnabled whether to enable the cookie
    - navigator.userAgent user agent

            navigator.userAgent.indexOf ( ' MSIE ' )> - . 1     detected low Edition IE 
            navigator.userAgent.indexOf ( ' molie ' )> - . 1    detects the moving end

 - navigator.systemLanguage User Agent language


- History History
    - history.go ()   1 step forward, 2 two steps forward - after one step back - 2 , two steps back
    - history.forward () to step forward
    - history.back () take a step back

 

 

Guess you like

Origin www.cnblogs.com/musong-out/p/11427393.html