ShowModalDialog (), ShowModelessDialog () method use details
JavaScript has many built-in methods to generate dialogs, such as Window.Art (), Window.confirm (), Window.Prompt (). Wait. However, IE provides more Method Support dialog. Such as:
ShowModalDialog () (IE 4 Support)
ShowModelessDialog () (IE 5 support)
WINDOW.SHOWMODALDIALOG () method is used to create a modal dialog that displays HTML content, because it is a dialog, it is not generally all attributes of Window.Open ().
WINDOW.SHOWMODELESSDIALOG () method is used to create a non-modular dialog that displays HTML content.
When we use ShowModelessDialog () to open the window, you don't have to use Window.close () to close it. When you open in a non-modular manner [IE5], the window to open the dialog can still be used, ie the dialog is not always It is the top focus, when it turns on its window URL, it automatically shuts down. The dialog box of the modal [IE4] is always focus (the focus cannot be removed until it is closed). The modal dialog box and the window that opens its window, so when we open another window, their link relationship is still saved and hidden below the active window.
The method is as follows:
VreturnValue = WINDOW.SHOWMODALDIALOG (SURL [, Varguments] [, SFEATURES])
VreturnValue = WINDOW.SHOWMODELESSDIALOG (SURL [, Varguments] [, SFEATURES])
Parameter Description:
SURL
Required parameters, type: string. The URL of the document to specify the dialog to display.
Varguments
Optional parameters, type: variants. Used to deliver parameters to the dialog. Parameters passing are not limited, including arrays, and more. The dialog box has obtained the passing parameters via Window.Dialogarguments.
SFEATURES
Optional parameters, type: string. The information used to describe the appearance of the dialog box can use one or several of the following, separated by a semicolon ";".
The Dialogheight dialog height, not less than 100px, IE4 DialogHeight and DialogWidth default unit is EM, and IE5 is PX, which is convenient to see it, in the dialog of the Modal mode, use PX to do units.
Dialogwidth: dialog width.
Dialogleft: Distance from the left desktop.
Dialogtop: Distance from the desktop.
Center: {YES | NO | 1 | 0}: Whether the window is hit, default Yes, but still specify the height and width.
Help: {yes | no | 1 | 0}: Whether to display the help button, default YES.
Resizable: {YES | NO | 1 | 0} [IE5 ]: Whether it can be changed. Default NO.
Status: {yes | no | 1 | 0} [IE5 ]: Whether the status bar is displayed. The default is YES [Modeless] or no [modal]. Scroll: {YES | NO | 1 | 0 | ON | OFF}: Indicates whether the dialog box displays the scroll bar. Default is YES.
There are also several properties to be used in HTA, which is generally not used in a general web page.
DialoGHide: {yes | no | 1 | 0 | ON | OFF}: Whether the dialog box is hidden when printing or printing preview. The default is NO.
Edge: {Sunken | Raised}: Indicates the border style of the dialog. Default is raised.
Unadorned: {yes | no | 1 | 0 | ON | OFF}: The default is NO.
Introduction parameters:
To pass the parameters, it is passed through Varguments. Types are not limited, for string type, up to 4096 characters. You can also transfer objects, for example:
TEST1.HTM
====================
VAR MXH1 = New Array ("MXH", "Net_LOVER", "Menciic E Chapter")
VAR MXH2 = WINDOW.OPEN ("About: Blank", "Window_MXH")
/ / Pass an array to the dialog
Window.ShowModalDialog ("Test2.htm", MXH1)
/ / Pass the Window object to the dialog
WINDOW.SHOWMODALDIALOG ("Test3.htm", MXH2)
script>
TEST2.HTM
====================
Var a = window.dialogarguments
Alert ("The parameters you pass are:" a)
script>
Test3.htm
====================
Var a = window.dialogarguments
Alert ("The parameters you pass are Window objects, name:" a.name)
script>
You can return information to the window to open the dialog over Window.ReturnValue, of course, can also be an object. E.g:
TEST4.HTM
===================
Var a = window.showmodaldialog ("test5.htm")
For (i = 0; i script> TEST5.HTM =================== Function sendto () { VAR a = new array ("a", "b") WINDOW.RETURNVALUE = a WINDOW.CLOSE () } script>