How to make good use of the modal window has always been a difficult place for me. Recently, a project was launched, in which the modal window was used to complete the data adjustment task. The following describes how to use the modal window.
A. aspx
<Br/> <! -- Introduce jquery --> <br/> <MCE: script src = "jquery. JS "mce_src =" jquery. JS "type =" text/JavaScript "> </MCE: SCRIPT> <br/> <MCE: script language =" JavaScript "type =" text/JavaScript "> <! -- <Br/> var uppic = function (ID) {<br/> var K = showmodaldialog (B. aspx? Newsid = '+ id, "", "dialogwidth: 400px; center: Yes; dialogheight: 80px; help: No; scroll: No; Status: No "); <br/> If (k = 1) {window. location. href = Window. location. href ;}; <br/>}< br/> // --> </MCE: SCRIPT> </P> <p> </pead> <br/> <body> <br/> <p onclick = "uppic (1) "> click my pop-up window </P> <br/> </body> <br/> </ptml>
Key of the above Code: var K = Module window code; If (k = 1) {window. Location. href = Window. Location. href ;}
B. aspx
<! -- Only list key code. aspx --> <br/> <meta http-equiv = "Pragma" content = "no-Cache"> <br/> <meta http-equiv = "cache-control" content = "no-cache, must-revalidate "> <br/> <pead> <br/> <base target =" _ Self "> <br/> </pead> <br/> <body> <br/> <asp: button id = "btnuploadpic" runat = "server" text = "Upload" onclick = "btnuploadpic_click"/> <br/> </body>
Key points of the above Code: <base target = "_ Self">
B. CS
Protected void btnuploadpic_click (Object sender, eventargs e) <br/>{< br/> response. Write ("<MCE: Script Type =" text/JavaScript "> <! -- <Br/> alert ('upload succeeded '); window. returnvalue = 1; window. close (); <br/> // --> </MCE: SCRIPT> "); <br/> // refresh page <br/> // scriptmanager. registerstartupscript (updatepanel1, this. getType (), "onclick", "window. returnvalue = 1; window. close (); ", true); // close some modal windows. The return value is 1 </P> <p>}