js打开子窗口关闭父窗口
2012-10-25 19:56
417 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>子父窗口的操作</title> </head> <body> <script> var win=null; function op(){ win=window.open("about:blank","win","width=200,height=200"); win.document.write("<input type='button' value='关闭父窗口' onclick='window.opener.opener=null;window.opener.close()'>"); win.document.write("<input type='button' value='刷新你窗口' onclick='window.opener.location.reload()'>"); } </script> </body> </html> <input onclick="op()" value="打开窗口" type="button"> <input type="button" value="最小化" onclick="if(win&&win.open&&!win.closed){win.resizeTo(0,0);win.moveTo(0,window.screen.width);}else alert('还没有打开窗口或已经关闭')"> <input type="button" value="最大化" onclick="if(win&&win.open&&!win.closed){win.moveTo(-4,-4);win.resizeTo(screen.availWidth+8,screen.availHeight+8);}else alert('还没有打开窗口或已经关闭');"> <input type=button value="关闭子窗口" onclick="if(win&&win.open&&!win.closed){win.opener=null;win.close()}else alert('还没有打开窗口或已关闭')"> <input type=button value="刷新子窗口" onclick="if(win&&win.open&&!win.closed){win.location.reload();win.focus()}else alert('窗口还没有打开或已关闭')"> <input type="button" value="看子窗口的大小" onclick="if(win&&win.open&&!win.closed){alert(win.document.body.clientWidth+'*'+win.document.body.clientHeight);win.focus();}else{alert('还没有打开窗口或者已关闭')};"> </body> </html>
相关文章推荐
- js检测window.open打开的窗口是否关闭
- JS打开新窗口,关闭本页刷新父页面
- window.open打开子窗口后关闭父窗口实现
- 解决extjs在firefox中关闭窗口再打开后iframe中js函数访问不到的问题
- 用javascript实现始终保持打开同一个子窗口以及关闭父窗口同时自动关闭所有子窗口
- fancybox 在打开窗口前 先执行 js脚本,fancybox设置只能通过右上角关闭,fancybox遮罩层关闭
- js关闭当前窗口,window.close()方法只能是window.open打开的才能执行关闭
- 始终保持打开同一个子窗口以及关闭父窗口同时自动关闭所有子窗口
- js如何关闭当前页,而不弹出提示框 尤其是万恶的IE||关闭子窗口同时刷新父窗口
- JS 打开新窗口没有工具栏 地址栏,同时关闭当前窗口
- 如何用JS打开新窗口,并关闭原来窗口
- 解决extjs在firefox中关闭窗口再打开后iframe中js函数访问不到的问题
- js关闭当前弹出的小窗口并打开新窗口
- js入门·打开/关闭指定URL的窗口/改变链接时候状态栏的文字
- js -- 打开新窗口(window.open)、关闭窗口(window.close)
- js入门·打开/关闭指定URL的窗口/改变链接时候状态栏的文字
- js 监测列表页面打开的新窗口,若新窗口关闭则刷新列表页面
- JS windows.open打开窗口并居中,且调用完执行colse关闭方法,父窗口打开,子窗口执行,然后执行关闭
- js 父窗口控制子窗口的行为-打开,关闭,重定位,回复
- js 打开新窗口 和关闭窗口