Create a modal dialog box that displays HTML content:
Vreturnvalue = window.showModalDialog (sURL [, varguments] [, Sfeatures])
Create a non-modal dialog box that displays HTML content:
Vreturnvalue = Window.showmodelessdialog (sURL [, varguments] [, Sfeatures])
sURL: (required parameter) string. Specifies the URL of the document to display
Varguments: any type.. The page pass parameters that you want to display: Parameters can use Window.dialogarguments to get
Sfeatures: String. Specifies the style of the dialog box ... Inside you can define one or multiple use semicolons ";" Separate
1. Dialogheight: Height of dialog box, not less than 100px
2. Dialogwidth: Width of the dialog box.
3. Dialogleft: Distance from the left of the screen.
4. Dialogtop: Distance from the screen.
5. Center: {yes | no | 1 | 0}: Center, default yes, but can still specify height and width.
6. Help: {yes | no | 1 | 0}: Whether to display the Assist button, default yes.
7. Resizable: {yes | no | 1 | 0} [ie5+]: Whether the size can be changed. Default No.
8. Status: {yes | no | 1 | 0} [ie5+]: Whether the status bar is displayed. Default is yes[Modeless] or no[modal].
9. Scroll: {yes | no | 1 | 0 | on | off}: Scroll bar is displayed. The default is yes.
Parent window:
1 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en">2 <HTML>3 <Head>4 <Scripttype= "Text/javascript">5 functionOpenwin () {6 window.showModalDialog ("a2.jsp", window,"Dialogheight:300px;dialogwidth:380px;status=no;help:yes;");7 }8 9 functionSetValue (cid,cname) {Ten document.getElementById ("CID"). Value=CID; One document.getElementById ("CNAME"). Value=cname; A } - </Script> - </Head> the <Body> - <formAction= "test.jsp"name= "Form1"Method= "POST"> -Customer ID:<inputtype= "text"name= "CID"value=""ID= "CID"/><BR> -Customer Name:<inputtype= "text"name= "CNAME"value=""ID= "CNAME"> + <inputtype= "button"name= "OK"value= "Please select customer"onclick= "Openwin ();"> - </form> + </Body> A </HTML>
child window:
1 <!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en">2 <HTML>3 <Head>4 <Scripttype= "Text/javascript">5 functionViewData (cid,cname) {6 //alert (cid+ "" +cname);7 /*8 * Window object for parent form page9 * Information on the parent form page is encapsulated in the Window.dialogarguments object of the subform pageTen */ One varsdata=window.dialogarguments; /*Sdata encapsulates the information for the parent form page * / A //alert (sdata); - Sdata.setvalue (cid,cname); - window.close (); the } - </Script> - </Head> - + <Body> - <TableBorder= "1"> + <TR> A <TD>Operation</TD> at <TD>Customer ID</TD> - <TD>Customer Name</TD> - </TR> - <TR> - <TD><inputtype= "button"value= "Select"ID= "ss"onclick= "ViewData (' 001 ', ' Shenzhen Huawei ');"/></TD> - <TD>001</TD> in <TD>Shenzhen Huawei</TD> - </TR> to <TR> + <TD><inputtype= "button"value= "Select"ID= "ss"onclick= "ViewData (' 002 ', ' UF software ');"/></TD> - <TD>002</TD> the <TD>UF software</TD> * </TR> $ </Table>Panax Notoginseng </Body> - </HTML>
Simple usage of window.showmodaldialog ()