js弹出子页面并将值返回父页面

父页面

<script type="text/javascript">

function openNewWin(){
var ret =window.showModalDialog("a2.jsp",{win:window},'dialogHeight:200px;dialogWidth:200px');
document.forms[0].ss.value=ret;
window.reload();

}
</script>

</head>


<body>
<form action="">
<input type="button" id="ss" onClick="openNewWin();" value="初始值">
</form>
</body>
</html>
子页面

<body>
<script language="javascript">
function test(){
window.returnValue = "返回值";
window.dialogArguments.win.location.reload();
window.close();
}

</script>
<input name=Button type=button value=关闭并刷新父页面 onClick="test()">

</body>
</html>

你可能感兴趣的:(JavaScript,html,jsp)