"Turn" JS windows.open () detailed

Source: Internet
Author: User

window.open (URL, name, features, replace)

Arguments -parameters

URL Optional String parameter that points to the URL of the document to display in a new window. If this argument is omitted, or if the argument is an empty string, the new window does not display the document.

name is an optional string parameter that sets the name of the new window. A window of the same name can only create one, and the name cannot be the same if you want to create multiple windows.

features Optional string parameter, which is used to set the function of the new window. Because the parameter is optional, if the parameter is not specified, the new window has all the standard features.

Replace to choose a Boolean parameter that sets how the operation history is saved in the new window. true -Create a new history false-replace old history

Returns -return value a reference to a newly created or existing Window object based on the name parameter.

Description -Description

The open () method can look for an existing or new browser window. If the name parameter specifies an existing Liu browser window, a reference to that window is returned. The returned window will display the document specified in the URL, but the features parameter will be ignored. The open () method is the only way in JavaScript to get the window reference of a viewer by name.

The open () method creates a new browser window if the name parameter is not specified, or if there is no window that has the names specified by the name parameter.

The name parameter is used to specify the names of the new windows, which must consist of letters, numbers, and underscore characters.  It can be pointed to by the <a> tag or <form> tag in the HTML document.

When you use the window.open () method to load a new document into a named window that already exists, you can set how the history is saved by using the Replace parameter ... If this argument is true, the history of the new document supersedes the history of the old document. If the parameter is false or if this parameter is not specified, the new file will establish its own entry in the window's browsing history. This parameter provides a way to Location.replace () the same functionality.

Do not confuse "window.open ()" and "Document.open ()", which is two completely different methods. To make the code clearer, you can replace "open ()" with "window.open ()". When you define an event handler as an HTML attribute, "open ()" is generally interpreted as "document.open ()", so you must use "window.open ()" In this case.

Window Features -Windows features

  The feature parameter is a comma-separated list of features. If the parameter is empty or if the parameter is not specified, the new window will have all the functionality. On the other hand, if the feature parameter specifies only one item or several features, other features that are not specified will not appear in the new window. The string cannot contain any spaces or other empty strings.

Format of each element in the list: function [= value]

For most functions, their values are generally yes or no. For these functions, the equals sign and the value can be omitted from being written. For the width and height attributes, you must specify a value in pixels.

Here are some of the universally supported features and their meanings:

height Setting the pixel width of the window display area

distance from left browser window to screen

location Indicates whether the address bar is visible in a new window

MenuBar Indicates whether the menu bar is visible in a new window

resizable Indicates whether the new window can be resized

scrollbars Indicates whether the scroll bar is visible in a new window

Status Indicates whether the state bar is visible in a new window

Toolbar Indicates whether the toolbar is visible in a new window

Top Set the distance from the top of the screen to the new window

width Setting the pixel widths of the window display area

alwayslowered The specified window is hidden under all windows

alwaysraised Specifies that the window floats above all windows

dependent Specifies that an open window is a child window of the parent window. and closes with the parent window closed

Directions Specifies whether the Navigator 2 and 3 directories are visible in a new window

hotkeys Set safe exit hotkey in new window without menu bar

innerheight Set the pixel height of the document in the new window

innerwidth Set the pixel width of the document in the new window

MenuBar Indicates whether the menu bar is visible in a new window

outerheight The pixel height of the setting window (including the decorative border)

outerwidth The pixel width of the setting window (including the decorative border)

ScreenX Set the pixel length of the new window from the screen boundary

ScreenY Set the pixel length of the new window from the top edge of the screen

titlebar Indicates whether the menu title bar is visible in the new window

  z-look contains an array of < Pplet > tags in the document

fullscreen open forms for full-screen display

Example -Example

  <html>

<head>

<title>window.open function </title>

</head>

<body>

      <script language="javascript">

window.open ("", "name1", "width=,height=,toolbar=No,scrollbars=No,   Menubar=No,screenx=,screeny=100 ");

</Script>

</body>

</html>

"Turn" JS windows.open () detailed

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.