设置open方法中的参数
发表于:2007-06-30来源:作者:点击数:
标签:
open method (window object)br Opens a new web browser window. br br 语法br [windowVar = ][window].open(quot;URLquot;, quot;windowNamequot;, [quot;windowFeaturesquot;])br br windowVar is the name of a new window. Use this variable when refer
open method (window object)<br>
Opens a new web browser window. <br>
<br>
语法<br>
[windowVar = ][window].open("URL", "windowName", ["windowFeatures"])<br>
<br>
windowVar is the name of a new window. Use this variable when referring to a window@#s properties, methods, and containership. <br>
URL specifies the URL to open in the new window. See the location object for a description of the URL components. <br>
windowName is the window name to use in the TARGET attribute of a <FORM> or <A> tag. windowName can contain only alphanumeric or underscore (_) characters. <br>
windowFeatures is a comma-separated list of any of the following options and values: <br>
<br>
toolbar[=yes|no]|[=1|0]<br>
location[=yes|no]|[=1|0]<br>
directories[=yes|no]|[=1|0]<br>
status[=yes|no]|[=1|0]<br>
menubar[=yes|no]|[=1|0]<br>
scrollbars[=yes|no]|[=1|0]<br>
resizable[=yes|no]|[=1|0]<br>
width=pixels<br>
height=pixels<br>
<br>
You may use any subset of these options. Separate options with a comma. Do not put spaces between the options. <br>
<br>
pixels is a positive integer specifying the dimension in pixels. <br>
<br>
Method of<br>
window <br>
<br>
Description<br>
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. <br>
<br>
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(). <br>
<br>
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. <br>
<br>
Following is a description of the windowFeatures: <br>
<br>
toolbar creates the standard Navigator toolbar, with buttons such as "Back" and "Forward", if true <br>
location creates a Location entry field, if true <br>
directories creates the standard Navigator directory buttons, such as "What@#s New" and "What@#s Cool", if true <br>
status creates the status bar at the bottom of the window, if true <br>
menubar creates the menu at the top of the window, if true <br>
scrollbars creates horizontal and vertical scrollbars when the document grows larger than the window dimensions, if true <br>
resizable allows a user to resize the window, if true <br>
width specifies the width of the window in pixels <br>
height specifies the height of the window in pixels <br>
例子<br>
In the following example, the windowOpener function opens a window and uses write methods to display a message: <br>
<br>
function windowOpener() {<br>
msgWindow=window.open("","displayWindow","menubar=yes")<br>
msgWindow.document.write<br>
("<HEAD><TITLE>Message window</TITLE></HEAD>")<br>
msgWindow.document.write<br>
("<CENTER><BIG><B>Hello, world!</B></BIG></CENTER>")<br>
}<br>
<br>
The following is an onClick event handler that opens a new client window displaying the content specified in the file sesame.htm. The window opens with the specified option settings; all other options are false because they are not specified. <br>
<br>
<FORM NAME="myform"><br>
<INPUT TYPE="button" NAME="Button1" VALUE="Open Sesame!"<br>
onClick="window.open<br>
(@#sesame.htm@#, @#newWin@#, @#scrollbars=yes,status=yes,width=300,height=300@#)"><br>
</FORM><br>
<br>
Notice the use of single quotes (@#) inside the onClick event handler. <br>
原文转自:http://www.ltesting.net