Window. pen (), window. pen
To open a new page in javascript, you can use window. pen ();
It has three parameters. The first parameter is to tell the browser which page to load.
The second is to set the value of the new window.
The third is the instruction for specifying features of a new window: its width and height, whether it contains the address bar, etc.
One:
[Javascript]View plaincopyprint?
- <Script>
- Window. open ();
- </Script>
A blank window is opened.
Two:
[Javascript]View plaincopyprint?
- <Script>
- Window. open ("http://www.baidu.com ");
- </Script>
The Baidu homepage is displayed in a new window.
Three:
[Javascript]View plaincopyprint?
- <Script>
- Window. open ("http://www.baidu.com", "_ self ");
- </Script>
Will open the Baidu homepage in its window
Four:
[Javascript]View plaincopyprint?
- <Script>
- Window. open ("http://www.baidu.com", "_ blank", "width = 300, height = 400, resizable = 'no', scrollbars = 'No '");
- </Script>
A new window with a length of 300 and a width of 400 is opened. The window size cannot be changed, and no scroll bar is displayed. The window is loaded into the Baidu homepage. Parameter _ blank refers to a new window. It is invalid to set the width and height in the window, for example:
[Javascript]View plaincopyprint?
- <Script>
- Window. open ("http://www.baidu.com", "_ self", "width = 300, height = 400, resizable = 'no', scrollbars = 'No '");
- </Script>
The width and height, whether the size can be changed, and whether the display scroll bar are not set successfully, because the third parameter takes effect only when the second parameter points to a non-itself new window.
In addition, modern browsers give users more and more control over the pop-up window. At this point, timely resizable is set to no, and most browsers still allow users to change the size of the pop-up window; even if scrollbars is set to no, the scroll bar is still displayed as needed.