Basic Introduction: The showModalDialog () (IE4 + supported) showModelessDialog () (IE5 + supported) window. showModalDialog () method is used to create a modal dialog box that displays HTML content. The window. showModelessDialog () method is used to create...
Basic Introduction:
ShowModalDialog () (IE 4 + supported)
ShowModelessDialog () (IE 5 + supported)
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.
Usage:
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. The passed parameter types are not limited, including arrays. Dialog Box passed
Window. dialogArguments to get the passed parameters.
SFeatures -- optional parameter; Type: String. Used to describe the appearance and other information of the dialog box. You can use one or more of the following, separated by semicolons.
----------------
1. dialogHeight: dialog box height, not smaller than 100px
2. dialogWidth: Dialog Box width.
3. dialogLeft: the distance from the left of the screen.
4. dialogTop: the distance from the screen.
5. center: {yes | no | 1 | 0}: whether to center. The default value is yes, but the height and width can still be specified.
6. help: {yes | no | 1 | 0}: whether to display the help button. The default value is yes.
7. 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 the status bar. The default value is yes [Modeless] or no [Modal].
9. scroll: {yes | no | 1 | 0 | on | off}: whether to display the scroll bar. The default value is yes.
The following attributes are used in HTA and are not used in general web pages.
10. dialogHide: {yes | no | 1 | 0 | on | off}: whether the dialog box is hidden when printing or previewing. The default value is no.
11. edge: {sunken | raised}: Specify the border style of the dialog box. The default value is raised.
12. unadorned: {yes | no | 1 | 0 | on | off}: no by default.
Parameter transfer:
1. vArguments is used to pass Parameters in the dialog box. The type is not limited. For string types, the maximum value is 4096 characters. Objects can also be passed, 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 ("the parameter you passed is:" + obj. name)
Script
-------------------------------
2. You can use window. returnValue to return information to the window that opens the dialog box. It can also 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://wwww.2cto.com ";
Script
Common tips:
1. How can I leave a new window in the superconnection between showModalDialog and showModelessDialog?
AddYou can. This sentence is generally placed in.
2. How can I refresh the content in showModalDialog and showModelessDialog?
In showModalDialog and showModelessDialog, you cannot press F5 to refresh or bring up a menu. This depends on
Javascript:
Reload...
Replace filename.htm with the webpage name and place it in the webpage you opened. Press F5 to refresh the page.
CooperationIf you press F5, a new window will pop up.
3. How to use javascript to close the window opened by showModalDialog (or showModelessDialog.
Must also be used togetherOtherwise, a new IE window will be opened and closed.
4. Math. random and showModalDialog.
When the pop-up page you set is fixed (such as the "modal.htm" Page, ie can easily access the local file area and download the next page (openpage.html) without reloading,
For Dynamically Loaded pages, this often leads to misunderstandings. If data is not updated in time, it is not conducive to developer testing. Therefore, you can use the following method:
Var strPage = "/medal.htm? Random = "+ Math. random ();
In this way, the strPage generated every time is different. The reason is self-evident.
From the blog of adamboy