window.showModalDialog () Used to create modal dialog boxes
The syntax is: Vreturnvalue = window.showModalDialog (sURL [, varguments] [, sfeatures]);
Parameters:
(1) sURL: Specifies the URL of the document to be displayed by the dialog box, string, required
(2) Varguments: parameters to be passed to the dialog box, variants (arrays, variables, etc.), optional
(3) Sfeatures: Generate dialog box appearance information, string, optional
--Appearance information parameters are:
| Dialogheight |
Height of dialog box |
No less than 100px |
| Dialogwidth |
dialog box width |
|
| Dialogleft |
Distance from the left of the screen |
|
| Dialogtop |
Distance from the screen |
|
| Center |
is centered |
Default Yes (yes:1,no:0) |
| Help |
Whether to display the Help button |
Default Yes |
| Resizable |
Whether the size can be changed |
Default No |
| Status |
Whether to display the status bar |
Modal default no,modeless default Yes |
| Scroll |
Whether scroll bars are displayed |
The default is Yes |
1<script type= "Text/javascript" >2 //Main Page Face3 functionOpenmodaldialog () {4 varMessage =NewArray ();5Message[0] = document.getElementById ("Linename"). Value;6MESSAGE[1] = Ocument.getelementbyid ("Fromstation"). Value;7MESSAGE[2] = document.getElementById ("Tostation"). Value;8 9 varobj = window.showModalDialog ("home/generate", message, ' dialogwidth:300px;dialogheight:380px; '));Ten One } A</script> -
Use Window.dialogarguments in an open dialog box to get the arguments passed in
1 <script type= "Text/javascript" >2 // dialog function Getarguments () { 4 var linename = Window.dialogarguments[0]; 5 var fromstationname = Window.dialogarg Uments[1]; 6 var tostationname = Window.dialogargum Ents[2]; 7 8 </script>
Return information to the window that opens the dialog box by Window.returnvalue
1 <script>2 window.returnvalue= "AAAAA"; 3 </script>
In addition, Showmodalessdialog usage is basically consistent
Modal and non-modal differences:
ShowModalDialog: The input focus is always maintained when it is opened. The user cannot switch to the main window unless the dialog box is closed. The effect is similar to alert operation.
showModelessDialog: After being opened, the user can randomly switch the input focus and have no effect on the main window.
window.showModalDialog () Usage