打开子窗口,子窗口关闭,父窗口跳转
这里一共有四个文件:first.jsp open.jsp second.jsp jump.js
first.jsp:父窗口
<html>
<script language="javascript" src="jump.js">
</script>
<body>
<p>first.html</p>
<form name ="first" method="post" action="second.jsp">
<input name="firstin" type="text" size="20" /><input type="button" value="提交" οnclick="openNew(document)" />
</form>
</body>
</html>
open.jsp :子窗口
<html>
<script language="javascript" src="jump.js">
</script>
<body>
<p>open.html</p>
<form name ="open" method="post" action="" >
<input name="openin" type="text" size="20" /><input name="" type="submit" value="提交" οnclick="DataSubmit()" />
</form>
</body>
</html>
second.jsp:first.jsp跳转窗口
jump.js:页面跳转的JavaScript代码
function openNew(first)
{
window.showModalDialog("open.jsp",first,"DialogWidth:800px;DialogHeight:600px");
};
function DataSubmit()
{
var a = window.dialogArguments;
alert(a.first.firstin.value);
a.first.submit();
window.close();
};