window.showModalDialog () Usage

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.