我写了一个框架代码,代码如下:
Response.Write("<script>window.open('createTest.aspx','添加学生记录','height=screen.height,width=screen.width,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=yes');window.top.opener=null;window.top.close();</script>");
在子框架中想点击按钮然后弹出新窗口,关闭打新窗口的窗口,在ie6中能实现,但是在ie8中就会出现“你查看的网页正在试图关闭窗口”的警告,后来在网上查了一下,有人是说用window.open('','_self')可以解决问题,于是把代码添加进去,代码如下:
Response.Write("<script>window.open('createTest.aspx','添加学生记录','height=screen.height,width=screen.width,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=yes');window.top.opener=null;window.top.open('','_self');window.top.close();</script>");这样虽然没有弹出警告窗口,但是新弹出的窗口也被关掉了,请高手帮忙