javascript - parent-child window in java script -
i want stop program flow until receive input child window.
code parent window:
<html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <title>mainpage</title> <script language="javascript"> function openpage(){ window.open("ok.htm","warning",'fullscreen=0,height=150,width=300,left=500,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,top=200'); //this place want program wait till input change in document.fm.w.value form child window/////// alert(document.fm.w.value);/// alert should contain new value acorrding selection of button in child window//// } </script> </head> <body> <form name="fm"> <input type="hidden" size="40" id="w" value="wwww"> <input type="button" value= "press" id="q" name= "q" onclick= "openpage();"> </form> </body> </html>
child window code:
<html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1252"> <title>warning</title> <script language="javascript"> function returntomainpage1() { window.opener.document.fm.w.value = "x" //self.close(); } function returntomainpage2() { window.opener.document.fm.w.value = "o" self.close(); } </script> </head> <body> <form name="fm"> <table id="messagetable" width="100%"> <tr> <td align="center"> <input type="button" value= "ok" id="latest_version" onclick= "returntomainpage1();"></td> <td>view latest released version</td> </tr> <tr> <td align="center"><input type="button" value= "ok" id="older_version" onclick= "returntomainpage2();"></td> <td>continue viewing obsolete version</td> </tr> </table> </form> </body> </html>
you don't. synchronous waiting bad idea in web apps.
you make modal dialog jquery; sounds want. new window yours designed stand-alone entity part.
Comments
Post a Comment