First, we will introduce the basic usage of a showmodaldialog.
Usage:
Vreturnvalue = Window. showmodaldialog (URL [, arguments] [, features])
Parameter description:
URL -- required parameter; Type: String. Specifies the URL of the document to be displayed in the dialog box.
Arguments -- optional parameter; Type: variant. Used to pass parameters to the dialog box. The passed parameter types are not limited, including arrays. The dialog box uses window. dialogarguments to obtain the passed parameters.
Features -- optional parameter; Type: String. Used to describe the appearance and other information of the dialog box. You can use one or more of the following, separated by semicolons.
1. dialogheight: the height of the dialog box.
2. dialogwidth: Dialog Box width.
3. dialogleft: the distance from the left of the screen.
4. dialogtop: the distance from the screen.
5. Center: {Yes | no | 1 | 0}: whether the window is centered. The default value 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 value is yes.
7. resizable: {Yes | no | 1 | 0} [ie5 +]: whether the size can be changed. No by default.
8. Status: {Yes | no | 1 | 0} [ie5 +]: whether to display the status bar. The default value is Yes [modeless] or no [modal].
9. Scroll: {Yes | no | 1 | 0 | on | off}: Specifies whether the scroll bar is displayed in the dialog box. The default value is yes.
The following attributes are used in HTA and are not used in general web pages.
10. dialoghide: {Yes | no | 1 | 0 | on | off}: whether the dialog box is hidden when printing or previewing. The default value is no.
11. Edge: {sunken | raised}: Specify the border style of the dialog box. The default value is raised.
12. unadorned: {Yes | no | 1 | 0 | on | off}: No by default.
The following are two examples of returned values:
<HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead> <br/> <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "/> <br/> <title> untitled document </title> <br/> <MCE: Script Type =" text/JavaScript "> <! -- <Br/> function compute () <br/> {<br/> var address = Window. showmodaldialog ("return.html", "aaaa", "dialogwidth = 400px; dialogheight = 200px"); <br/> document.myform.txt returnvalue. value = address; <br/>}< br/> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <form name = "myform" method = "Post"> <br/> <Div> <br/> <div> <input type = "button" name = "XXX" value = "Return Value" onclick = "inline () "/> <input type =" text "name =" txtreturnvalue "/> </div> <br/> </form> <br/> </body> <br/> </ptml>
<HTML> <br/> <pead> <br/> <title> </title> <br/> <MCE: Script Type = "text/JavaScript"> <! -- <Br/> function returntest () <br/>{< br/> window. returnvalue = "I am the return value"; <br/> window. close (); </P> <p >}< br/> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <form> <br/> <input type = "button" onclick = "returntest () "value =" Return Value "/> <br/> </form> <br/> <body> <br/> <HTML>
// Configure //----------------------------------------------------------------------------------------------------------------------
<HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead id = "head1" runat = "server"> <br/> <title> No title page </title> <br/> <MCE: script Type = "text/JavaScript"> <! -- <Br/> function btnclick () <br/> {<br/> var ret = Window. showmodaldialog ("B. aspx"); <br/> If (Ret! = NULL) <br/>{< br/> specify your doc ument. getelementbyid ("textbox1 "). value = RET [0]; <br/> Please specify Doc ument. getelementbyid ("textbox2 "). value = RET [1]; <br/>}< br/> return false; <br/>}</P> <p> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <Form ID = "form1" runat = "server"> <br/> <Div> <br/> <asp: textbox id = "textbox1" runat = "server"> </ASP: textbox> <br/> <asp: textbox id = "textbox2" runat = "server"> </ASP: textbox> <br/> <asp: button id = "button1" runat = "server" text = "button" onclientclick = "Return btnclick (); "/> <br/> </div> <br/> </form> <br/> </body> <br/> </ptml>
<HTML xmlns = "http://www.w3.org/1999/xhtml"> <br/> <pead id = "head1" runat = "server"> <br/> <title> No title page </title> <br/> <MCE: script Type = "text/JavaScript"> <! -- <Br/> function btnclick () <br/> {<br/> var ret = new array (2); <br/> RET [0] = "AA "; <br/> RET [1] = "BB"; <br/> window. returnvalue = ret; <br/> window. close (); <br/> return false; <br/>}</P> <p> // --> </MCE: SCRIPT> <br/> </pead> <br/> <body> <br/> <Form ID = "form1" runat = "server"> <br/> <Div> <br/> <asp: button id = "button1" runat = "server" text = "button" onclientclick = "Return btnclick () "/> <br/> </div> <br/> </form> <br/> </body> <br/> </ptml>