日期:2014-05-18  浏览次数:20670 次

window.open和showModalDialog的问题?
有这样一个功能
A页面打开B页面,B页面向服务器交换数据,得到数据传回A

我用window.open实现了这个功能,但用这个方法打开B页面,
B页面的焦点是活的,我想把焦点定死在B上

所以我选用window.showModalDialog打开B页面
但现在的问题是B页面接受不到服务器传回数据
severlet传回来后,是打开一个新的B页面
(用open的话,sverlet就能传到原来的页面)

为什么用open,和showModalDialog打开会这样不同?

------解决方案--------------------
你在B页面的 <head> </head> 之间加上 <base target= "_self "> 表示在B页面进行操作,这样就不会弹出新的界面了,但是从B页面往A页面带回值,我也没有解决呢。
帮你顶一下,大家一起努力学习!
------解决方案--------------------
使用showModalDialog可以!

在showModalDialog窗口中加入
function closewin()
{
if(event.clientX> document.body.clientWidth&&event.clientY <0||event.altKey) //检测窗口关闭事件
{
self.close();
window.opener.location.href= "xxx.jsp?xx=要传的参数 ";

}
}
并在body中加onbeforeunload= "closewin() "

试试行不行!