window.showModalDialog () Use method:
var returnvalue = window.showmodaldialog (URL [, arguments] [, features]);
URL-- required parameter, type: string, to specify the URL of the document to display in the dialog box
arguments-- optional parameter, type: Variant, used to pass parameters to the dialog box, pass the parameter type is not limited, including arrays, dialog box through the window.dialogarguments to get the parameters passed in
Features-- optional parameters, type: strings, used to describe the appearance of dialog boxes, and so on, you can use the following one or several, with semicolons ";" Separated
Dialogheight: Dialog box height, not less than 100px
Dialogwidth: Dialog box width
Dialogleft: The distance from the left of the screen
Dialogtop: The distance from the screen
center:{Yes | no | 1 | 0}: Center, default yes, but can still specify height and width
Help:{yes | no | 1 | 0}: Show Help button, default Yes
Resizable:{yes | no | 1 | 0} [ie5+]: Can be changed size, default No
Status:{yes | no | 1 | 0} [ie5+]: Show status bar, default to yes[Modeless] or No[modal]
scroll:{Yes | no | 1 | 0 | on | off}: Scroll bar is displayed, default is Yes
Parameter passing:
1. To pass arguments to the dialog box, it is passed through the arguments, the type is not limited, for the string type, the maximum is 4,096 characters, you can also pass the object, for example:
Parent.htm
Copy Code code as follows:
<script>
var obj = new Object ();
Obj.name= "justflyhigh.com";
window.showModalDialog ("modal.htm", obj, "dialogwidth=200px;dialogheight=100px");
</script>
Modal.htm
Copy Code code as follows:
<script>
var obj = window.dialogarguments;
Alert ("The parameter you passed is:" + obj.name)
</script>
2. You can return information by Window.returnvalue to the window that opens the dialog box, or you can also be an object, for example:
Parent.htm
Copy Code code as follows:
<script>
var result =window.showmodaldialog ("modal.htm", "dialogwidth=200px;dialogheight=100px");
alert (result);
</script>
Modal.htm
Copy Code code as follows:
<script>
Window.returnvalue= "Http://www.jb51.net";
</script>