1. Basic Knowledge
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. |
2. Usage
Vreturnvalue = Window. showmodaldialog (Surl [, varguments] [, sfeatures]); Vreturnvalue = Window. showmodelessdialog (Surl [, varguments] [, sfeatures]); |
3. parameter description
Parameter Name |
Nature |
Type |
Function |
Surl |
Required |
String |
Specifies the URL of the webpage to be displayed in the dialog box. |
Varguments |
Optional |
Variant |
Used to pass parameters to the dialog box. The parameter type is not limited. The dialog box uses window. dialogarguments to obtain the passed parameters. |
Sfeatures |
Optional |
String |
Used to describe the appearance and other information of the dialog box. |
4. sfeatures parameter description
Parameter Name |
Parameter attributes |
Description |
Dialogheight |
Npx |
Dialog height, not smaller than PX |
Dialogwidth |
Npx |
Dialog Box width |
Dialogleft |
Npx |
Distance from the left of the Main Window |
Dialogtop |
Npx |
Distance from the main window |
Center |
{Yes | no | 1 | 0} |
Whether the window is centered. The default value is yes. |
Help |
{Yes | no | 1 | 0} |
Whether to display the Help button. The default value is yes. |
Resizable |
{Yes | no | 1 | 0} |
Whether the size can be changed. The default value is no. |
Status |
{Yes | no | 1 | 0} |
Whether to display the status bar. The default value is Yes [modeless] or no [modal]. |
Dialoghide |
{Yes | no | 1 | 0 | on | off} |
Whether the dialog box is hidden during print or print preview. The default value is no. |
Scroll |
{Yes | no | 1 | 0 | on | off} |
Specifies whether the scroll bar is displayed in the dialog box. The default value is yes. |
Edge |
{Sunken | raised} |
Specifies the border style of the dialog box. The default value is raised. |
Unadorned |
{Yes | no | 1 | 0 | on | off} |
The default value is no. |
Note: The dialoghide, edge, and unadorned attributes are used in HTA (HTML aplication) and are generally unavailable on webpages. |
5. varguments is used to pass Parameters. There is no restriction on the type. For the string type, the maximum value is 4096 characters. You can also pass objects. For example:
Parent.htm <SCRIPT> Window. showmodaldialog ("sun.htm", "passed parameters", "Help: No; scroll: No "); </SCRIPT> Sun.htm <SCRIPT> Alert ("Incoming parameters:" + window. dialogarguments ); </SCRIPT> |
6. the return value uses window. returnvalue to return information to the window that opens the dialog box. It can also be an object. For example:
Parent.htm <SCRIPT> Result = Window. showmodaldialog ("son.htm", "", "Help: No; scroll: No "); Alert (result ); </SCRIPT> Son.htm <SCRIPT> Window. returnvalue = "store the returned results here "; </SCRIPT> |
7. Prevent opening a new window after submission in the modal window
Add <base target = "_ Self">
8. Call the parent window method and PASS Parameters