Use of the js showModalDialog parameter

  • 2020-03-30 01:15:40
  • OfStack

Basic introduction:


VReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])
VReturnValue = window. ShowModelessDialog (sURL vArguments [,] [sFeatures])

Parameter description:

SURL                -- required parameter, type: string. Specifies the URL of the document to be displayed in the dialog box.

vArguments     -- optional parameter, type: variant. Used to pass parameters to the dialog box. There is no limit to the types of arguments you can pass, including arrays, etc. The dialog box gets the arguments passed in through window.dialogarguments.

sFeatures       -- optional parameter, type: string. To describe the appearance of the dialog box, you can use one or more of the following, using the semicolon ";" Separated.

1. The dialogHeight:     Dialog height, not less than 100px
2. DialogWidth:     Dialog width.
3. DialogLeft:       The distance to the left of the screen.
4. DialogTop:       Distance from the screen.
5. Center:   {yes | no | 1 | 0} : center, default yes, but you can still specify the height and width.
6. Help: {yes | no | 1 | 0} :           If the help button is displayed, the default is yes.
7. The resizable:   {yes | no | 1 | 0} [IE5+] :       Whether the size can be changed. No by default.
8. Status :{yes | no | 1 | 0} [IE5+] : whether to display status bar. The default is yes[Modeless] or no[Modal].
9. Scroll :{yes | no | 1 | 0 | on | off} : The default is yes.

The following properties are used in HTA and are not used in normal web pages.

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} : specify the border style of the dialog box. The default is raised.
12. Unadorned: {yes | no | 1 | | 0 on | off} : the default value is no.

Parameter transfer:

1. To pass arguments to the dialog box, pass them through vArguments. Type is unrestricted, with a maximum of 4096 characters for string types. Objects can also be passed, for example:

The parent. HTM

  var obj = new Object();"51js";
  var obj = window.dialogArguments
  alert(" The parameters you passed are: " +

2. Information can be returned to the window that opens the dialog box through window.returnvalue, or it can be an object. Such as:

The parent. HTM

         str =window.showModalDialog("modal.htm",,"dialogWidth=200px;dialogHeight=100px");

Related articles: