大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> Script -> 子父窗口之间的操作之小例子

子父窗口之间的操作之小例子

时间: 2021-07-31 作者:daque

test.htm  

<html><head><meta http-equiv="content-type" content="text/html; charset=utf8"><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><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>

运转功效如次:

 

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.