malalam
Messages postés
10839
Date d'inscription
lundi 24 février 2003
Statut
Membre
Dernière intervention
2 mars 2010
25
25 déc. 2004 à 11:02
Tiens, et t'affoles pas, ca a l'air long et complique mais ca ne l'est pas.
open (window object)
Method. Opens a new web browser window.
Syntax
[windowVar = ][window].open("URL", "windowName", ["windowFeatures"])
Parameters
windowVar is the name of a new window. Use this variable when referring to a window's properties, methods, and containership.
URL specifies the URL to open in the new window. See the location object for a description of the URL components.
windowName is the window name to use in the TARGET attribute of a FORM or tag. windowName can contain only alphanumeric or underscore (_) characters.
windowFeatures is a comma-separated list of any of the following options and values:
toolbar[=yes|no]|[=1|0] location[=yes|no]|[=1|0] directories[=yes|no]|[=1|0] status[=yes|no]|[=1|0] menubar[=yes|no]|[=1|0] scrollbars[=yes|no]|[=1|0] resizable[=yes|no]|[=1|0] width=pixels height=pixels
You may use any subset of these options. Separate options with a comma. Do not put spaces between the options. The windowFeatures are:
toolbar creates the standard Navigator toolbar, with buttons such as Back and Forward, if true.
location creates a Location entry field, if true.
directories creates the standard Navigator directory buttons, such as What's New and What's Cool, if true.
status creates the status bar at the bottom of the window, if true.
menubar creates the menu at the top of the window, if true.
scrollbars creates horizontal and vertical scrollbars when the document grows larger than the window dimensions, if true.
resizable allows a user to resize the window, if true.
width specifies the width of the window in pixels.
height specifies the height of the window in pixels.
Method of
window object
Implemented in
Navigator 2.0
Description
The open method opens a new Web browser window on the client, similar to choosing New Web Browser from the File menu of the Navigator. The URL argument specifies the URL contained by the new window. If URL is an empty string, a new, empty window is created.
In event handlers, you must specify window.open() instead of simply using open(). Due to the scoping of static objects in JavaScript, a call to open() without specifying an object name is equivalent to document.open().
windowFeatures is an optional, comma-separated list of options for the new window. The Boolean windowFeatures options are set to true if they are specified without values, or as yes or 1. For example, open("", "messageWindow", "toolbar") and open("", "messageWindow", "toolbar=1") both set the toolbar option to true. If windowName does not specify an existing window and you do not specify windowFeatures, all Boolean windowFeatures are true by default. If you specify any item in windowFeatures, all other Boolean windowFeatures are false unless you explicitly specify them. After a window is open, you cannot use JavaScript to change the windowFeatures.
You can use open on an existing window, and if you pass the empty string for the URL, you will get a reference to the existing window, but not load anything into it. You can, for example, then look for properties in the window.
Examples
In the following example, the windowOpener function opens a window and uses write methods to display a message:
function windowOpener() { msgWindow=window.open("","displayWindow","menubar=yes") msgWindow.document.write ("<HEAD><TITLE>Message window</TITLE></HEAD>") msgWindow.document.write ("<CENTER> Hello, world! </CENTER>")}
The following is an onClick event handler that opens a new client window displaying the content specified in the file sesame.html. The window opens with the specified option settings; all other options are false because they are not specified.
<FORM NAME ="myform"></FORM>
Notice the use of single quotes (') inside the onClick event handler.
See also
close (window object) method