Javascript java脚本中的父子窗口

Javascript java脚本中的父子窗口,javascript,Javascript,我想停止程序流,直到我收到来自子窗口的输入 父窗口的代码: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>MainPage</title> <SCRIPT LANGUAGE="JavaScript"> function openpage(){ window.open("ok.ht

我想停止程序流,直到我收到来自子窗口的输入

父窗口的代码:

<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 the place i want my program to wait till i get any  input that is any change in document.fm.w.value form my child window///////
alert(document.fm.w.value);/// alert should contain the new value acorrding to 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>

主页
函数openpage(){
打开(“ok.htm”,“警告”,“全屏=0,高度=150,宽度=300,左侧=500,位置=0,菜单栏=0,可调整大小=0,滚动条=0,状态=0,标题栏=0,工具栏=0,顶部=200”);
//这是我希望我的程序等待的地方,直到我从我的子窗口获得document.fm.w.value中任何更改的输入///////
alert(document.fm.w.value);///根据子窗口中按钮的选择,alert应包含新值////
}
子窗口代码:

<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>

警告
函数returntoInput1(){
window.opener.document.fm.w.value=“X”
//self.close();
}
函数returntoInput2(){
window.opener.document.fm.w.value=“O”
self.close();
}
查看最新发布的版本
继续查看过时版本

你几乎肯定不会。在web应用程序中,像这样的同步等待通常是个坏主意

您可以使用jQuery创建一个模态对话框;听起来像是你想要的。像您这样的新窗口在很大程度上被设计成一个独立的实体