日期:2014-05-16  浏览次数:20337 次

window.opener 问题
<script   language=javascript>  
  window.open( 'index.htm ',   'window ',   ' ');  
  closeWindow(window);  
  function   closeWindow(P_curWindow)
{
                  if(P_curWindow.opener   !=   null)   //执行到这行时报错,错误:没有权限
{
closeWindow(P_curWindow.opener);
P_curWindow.opener   =   null;
P_curWindow.close();
}
else
{
if(P_curWindow.parent   !=   null)
{
P_curWindow.parent.close();
}
else
{
P_curWindow.opener   =   null;
P_curWindow.close();
}
}  
}  
</script>


操作系统是xp   sp2,各位大侠如何解决这个问题啊?

------解决方案--------------------
父窗口用P_curWindow.parent调用足够了,本地调用P_curWindow.opener也显示空白的
------解决方案--------------------
<!--这句话拿个参数接着-->
var cid=window.open( 'index.htm ', null, ' ');
closeWindow(cid.window);
<!--
注open方法只能打开一个已有的页面
opener方法是能是在index.htm里才能使用,在其它网页里都是null
-->

------解决方案--------------------
try this

<script language=”JavaScript”>
//定义新窗口
var newWindow = window.open(“1.html”,”newWindow”);
newWindow.close(); //在父窗口中关闭打开的新窗口
</script>
//-------------------------
//在新窗口中关闭父窗口
window.opener.close()

------解决方案--------------------
那如何关闭新窗口时不弹出对话框