search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

window object

JavaScript can obtain many objects provided by the browser and perform operations.

window

The window object not only serves as the global scope, but also represents the browser window.

The window object has innerWidth and innerHeight properties, which can get the internal width and height of the browser window. The internal width and height refers to the net width and height used to display the web page after removing placeholder elements such as menu bars, toolbars, and borders.

Compatibility: IE<=8 is not supported.

<html>
<head>
    <script>
        'use strict';
        alert('window inner size: ' + window.innerWidth + ' x ' + window.innerHeight);
    </script>
</head>
<body>
</body>
</html>

Correspondingly, there is also an outerWidth and outerHeight attribute, which can obtain the entire width and height of the browser window.


new file
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>window对象</title> <script type="text/javascript"> function myFunction() { alert("欢迎来到phpd中文网") window.open('//m.sbmmt.com','_blank','width=600 height=400') } </script> </head> <body> <form> <input type="button" value="点击我,打开新窗口" onclick="myFunction()" /> </form> </body>
Reset Code
Automatic operation
submit
Preview Clear