Home >Web Front-end >JS Tutorial >window.showModalDialog User Manual_Basic Knowledge

window.showModalDialog User Manual_Basic Knowledge

WBOY
WBOYOriginal
2016-05-16 19:20:541434browse

Author: norika Compilation date: June 17, 2004

Basic introduction:
showModalDialog() (IE 4 supported)
showModelessDialog() (IE 5 supported)
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. Used to specify the URL of the document to be displayed in the dialog box.
vArguments--
Optional parameters, type: variant. Used to pass parameters to the dialog box. The type of parameters passed is not limited, including arrays, etc. The dialog box obtains the parameters passed in through window.dialogArguments.
sFeatures--
Optional parameter, type: string. Used to describe the appearance of the dialog box and other information, you can use one or more of the following, separated by semicolons ";".
1.dialogHeight: Dialog height, not less than 100px. The default units of dialogHeight and dialogWidth in IE4 are em, while in IE5 it is px. For convenience, when defining modal dialog boxes, use px as the unit. .
2.dialogWidth: Dialog width.
3.dialogLeft: Distance from the left side of the screen.
4.dialogTop: Distance from the screen.
5.center: {yes | no | 1 | 0}: Whether the window is centered, the default 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 is yes.
7.resizable: {yes | no | 1 | 0} [IE5+]: Whether it can be resized. The default is no.
8.status: {yes | no | 1 | 0} [IE5]: Whether to display the status bar. The default is yes[Modeless] or no[Modal].
9.scroll:{ yes | no | 1 | 0 | on | off }: Indicate whether the dialog box displays scroll bars. The default is yes.
The following attributes are used in HTA and are generally not used in ordinary web pages.
10.dialogHide:{ yes | no | 1 | 0 | on | off }: Whether the dialog box is hidden during printing or print preview. The default is no.
11.edge:{ sunken | raised }: Specifies the border style of the dialog box. The default is raised.
12.unadorned:{ yes | no | 1 | 0 | on | off }: The default is no.

Parameter passing:
1. To pass parameters to the dialog box, they are passed through vArguments. There is no limit on the type. For string types, the maximum length is 4096 characters. Objects can also be passed, for example:
----------------------------------
parent.htm


modal.htm


----------------------------------
2. You can use window.returnValue to return information to the window where the dialog box is opened. Of course, it can also be an object. For example:
-----------------------------
parent.htm
<script> <BR>var obj = new Object(); <BR>obj.name="51js"; <BR>window.showModalDialog("modal.htm",obj,"dialogWidth=200px;dialogHeight=100px"); <BR></script> <script> <BR>var obj = window.dialogArguments <BR>alert("您传递的参数为:" + obj.name) <BR></script> modal.htm <script> <BR>str =window.showModalDialog("modal.htm",,"dialogWidth=200px;dialogHeight=100px"); <BR>alert(str); <BR></script><script> <BR>window.returnValue="http://www.51js.com"; <BR></script>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn