First, window.open () Support environment: javascript1.0+/jscript1.0+/nav2+/ie3+/opera3+
Second, the basic grammar:
window.open (Pageurl,name,parameters)
which
Pageurl as child window path
Name is a child window handle
Parameters is the window parameter (each parameter is separated by commas)
Three, example:
<SCRIPT>
<!--
window.open (' page.html ', ' newwindow ', ' Height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, Resizable=no,location=no, Status=no ')
Write a line
-
</SCRIPT>
After the script runs, Page.html will open in the new form NewWindow, with a width of 100, a height of 400, 0 pixels from the top of the screen, 0 pixels left on the screen, no toolbars, no menu bars, no scroll bars, no resizing, no address bar, no status bar.
Please compare.
In the above example, there are a few parameters that are commonly used, and there are many other parameters, see four.
Four, the parameters
Where yes/no can also use 1/0;pixel value for a specific value, unit pixels.
Parameters | Range of Values | Description
| |
alwayslowered | yes/no | Specifies that the window is hidden after all windows
alwaysraised | yes/no | Specifies that the window hovers above all windows
depended | yes/no | Whether to close at the same time as the parent window
Directories | yes/no | NAV2 and 3 's catalog columns are visible
Height | Pixel value | Window height
hotkeys | yes/no | Set safe exit Hotkey in window without menu bar
Innerheight | Pixel value | The pixel height of the document in the window
Innerwidth | Pixel value | The pixel width of the document in the window
Location | yes/no | Whether the location bar is visible
MenuBar | yes/no | Whether the menu bar is visible
Outerheight | Pixel value | Set the pixel height of the window (including the decorative border)
Outerwidth | Pixel value | Set the pixel width of the window (including the decorative border)
resizable | yes/no | Whether the window size can be adjusted
ScreenX | Pixel value | The pixel length of the window from the left edge of the screen
ScreenY | Pixel value | The pixel length of the window from the top edge of the screen
ScrollBars | yes/no | Whether the window can have a scroll bar
TitleBar | yes/no | Whether the window title bar is visible
Toolbar | yes/no | Whether window toolbars are visible
Width | Pixel value | The pixel width of the window
Z-look | yes/no | Whether the window is activated to float on top of other windows
window.showModalDialog User Manual
Basic Introduction:
ShowModalDialog () (IE 4+ support)
showModelessDialog () (IE 5+ support)
The window.showModalDialog () method is used to create a modal dialog box that displays HTML content.
The Window.showmodelessdialog () method is used to create a non-modal dialog box that displays HTML content.
How to use:
Vreturnvalue = window.showModalDialog (sURL [, varguments] [, Sfeatures])
Vreturnvalue = Window.showmodelessdialog (sURL [, varguments] [, Sfeatures])
Parameter description:
surl--
Required parameter, type: String. Used to specify the URL of the document to be displayed by the dialog box.
varguments--
Optional parameter, type: Variant. Used to pass parameters to the dialog box. There are no limits on the types of arguments passed, including arrays. The dialog box uses window.dialogarguments to get the arguments passed in.
sfeatures--
Optional parameter, type: String. Used to describe the appearance of the dialog box and other information, you can use the following one or several, with a semicolon ";" Separated.
1.dialogHeight: Dialog height, not less than 100px,ie4 in dialogheight and dialogwidth the default unit is EM, and IE5 is PX, for the convenience of its see, in the definition of modal Mode dialog box, use PX to do the unit.
2.dialogWidth: Width of the dialog box.
3.dialogLeft: The distance from the left of the screen.
4.dialogTop: Distance from the screen.
5.center: {yes | no | 1 | 0}: The window is centered, the default is yes, but you can still specify the height and width.
6.help: {yes | no | 1 | 0}: Whether the Help button is displayed, default yes.
7.resizable: {yes | no | 1 | 0} [ie5+]: Whether the size can be changed. Default No.
8.status: {yes | no | 1 | 0} [ie5+]: Whether the status bar is displayed. Default is yes[Modeless] or no[modal].
9.scroll:{Yes | no | 1 | 0 | on | off}: Indicates whether the dialog box displays a scroll bar. The default is yes.
The following properties are used in an HTA and are generally not used in general Web pages.
10.dialoghide:{Yes | no | 1 | 0 | on | off}: Whether the dialog box is hidden when printing or printing preview. The default is No.
11.edge:{Sunken | raised}: Indicates the border style of the dialog box. The default is raised.
12.unadorned:{Yes | no | 1 | 0 | on | off}: default is No.
Parameter passing:
1. To pass a parameter to a dialog box, pass it through varguments. Type is not limited, for string types, the maximum is 4,096 characters. You can also pass objects, for example:
-------------------------------
Parent.htm
<script>
var obj = new Object ();
Obj.name= "51js";
window.showModalDialog ("modal.htm", obj, "dialogwidth=200px;dialogheight=100px");
</script>
Modal.htm
<script>
var obj = window.dialogarguments
Alert ("You passed the parameter:" + obj.name)
</script>
-------------------------------
2. You can return information by Window.returnvalue to the window that opens the dialog box, or it can be an object. For example:
------------------------------
Parent.htm
<script>
Str =window.showmodaldialog ("modal.htm",, "dialogwidth=200px;dialogheight=100px");
alert (str);
</script>
Modal.htm
<script>
Window.returnvalue= "http://www.51js.com";
</script>
Currency definition Section
var psaddstr= "processid=" +processid+ "&addflag=" +isaddflag+ "&bzbh=" +vsbzbh+ "&bzmc=" +vsBZMC+ "& Bzfh= "+vsbzfh+" &jd= "+VSJD;
var result=window.showmodaldialog ("Addsave.asp?") +psaddstr, "," dialogheight:250px;dialogwidth:250px;status:no; ");