Window. pen (), window. pen

Source: Internet
Author: User

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?
  1. <Script>
  2. Window. open ();
  3. </Script>

A blank window is opened.

Two:

[Javascript]View plaincopyprint?
  1. <Script>
  2. Window. open ("http://www.baidu.com ");
  3. </Script>

The Baidu homepage is displayed in a new window.

Three:

[Javascript]View plaincopyprint?
  1. <Script>
  2. Window. open ("http://www.baidu.com", "_ self ");
  3. </Script>

Will open the Baidu homepage in its window

Four:

[Javascript]View plaincopyprint?
  1. <Script>
  2. Window. open ("http://www.baidu.com", "_ blank", "width = 300, height = 400, resizable = 'no', scrollbars = 'No '");
  3. </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?
  1. <Script>
  2. Window. open ("http://www.baidu.com", "_ self", "width = 300, height = 400, resizable = 'no', scrollbars = 'No '");
  3. </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.

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.