判断window.open的页面是否已经被关
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script>
var myWindow;
function openWin(){
myWindow=window.open("","","width=400,height=200");
}
function closeWin(){
if (myWindow){
myWindow.close();
}
}
function checkWin(){
if (!myWindow){
document.getElementById("msg").innerHTML="我的窗口没有被打开!";
}
else{
if (myWindow.closed){
document.getElementById("msg").innerHTML="我的窗口被关闭!";
}
else{
document.getElementById("msg").innerHTML="我的窗口没有被关闭!";
}
}
}
</script>
</head>
<body>
<input type="button" value="打开我的窗口" onclick="openWin()" />
<input type="button" value="关闭我的窗口" onclick="closeWin()" />
<br><br>
<input type="button" value="我的窗口被关闭了吗?" onclick="checkWin()" />
<br><br>
<div id="msg"></div>
</body>
</html>
判断window.open的页面是否已经被关的更多相关文章
- window.print() 打印页面部分内容的方法
用 JavaScript 实现页面数据的打印 : 主要是用到了一个 print() 函数 , 该函数将会打印整个 web 页面 body 内的所有 html 数据 ! 使用方法为 window.pri ...
- Window.focus()让页面成为当前窗体
Window.focus()让页面成为当前窗体 最近在弄在线客服的时候,想在收到信息时候让窗体自动弹出到最前,最小化的时候也是弹出到最前.本来以为很麻烦,问了好多人,都不知道,在网上查资料也没有查到. ...
- 【转】iframe和父页,window.open打开页面之间的引用
[转]iframe和父页,window.open打开页面之间的引用 iframe和父页,window.open打开页面和被打开页面之间的关系可以通过下面的对象获取到 1)通过iframe加载的,在if ...
- js 刷新windows.open另一个窗口页面或window.open的页面如何刷新(父页面)上层页面
一.js完整代码如下: //js打开新窗口 functionopenWin() {window.open('addInfo.jsp', '_blank','width=300,height=400,t ...
- window.location.hash 页面跳转,精确定位,实例展示:
window.location.hash 页面跳转,精确定位,实例展示: (1).index.phtml,页面用于传参 <script id="bb_list_template&quo ...
- 完好用户体验: 活用window.location与window.open解决页面跳转问题
原文地址: JavaScript Redirects and window.open原文日期: 2014年08月27日翻译日期: 2014年08月31日翻译人员: 铁锚 (译者注: 本文解决的是按 C ...
- 点击按钮使用window.open打开页面后,再次点击按钮会再打开一个页面,如何解决?
点击按钮使用window.open打开页面后,再次点击按钮会再打开一个页面,如何解决? window.open("page1.html","win1"); 这句 ...
- JS判断是否是微信页面,判断手机操作系统(ios或android)并跳转到不同下载页面
JS判断客户端是否是iOS或者Android 参考:http://caibaojian.com/browser-ios-or-android.html function is_weixin() { v ...
- $(window).scroll在页面没有滚动条时无法触发事件的bug解决方法
JS //给页面绑定滑轮滚动事件 if (document.addEventListener) { //webkit document.addEventListener('mousewheel', s ...
随机推荐
- hdu 1392 Surround the Trees 凸包裸题
Surround the Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- @Autowired 警告 Field injection is not recommended Spring @Autowired注入
问题: 一. 在IDEA升级2017版后,发现以前使用的 @Autowired 出现了个警告 Field injection is not recommended. @Autowired的三种使用方式 ...
- activity 的跳转
在app文件夹上右键新建空的activity ,名称为DisplayMessageActivity, 修改layout文件夹下activity_display_message.xml <?xml ...
- .NET Core 管道
从用户发请求到服务器响应返回数据 请求从 Request进去 先经过 Middleware(中间件) 然后经过AuthoriationFilters授权验证(token验证和 多租户验证) 在经 ...
- 学习笔记30—Windows那些事
1.win10编程窗口:powerShell 2.Win7设置工具栏折叠:我们只需要在底部任务栏空白位置点击鼠标右键,然后选择“属性”,在弹出额属性对话框中,将“任务栏按钮”后面的“始终合并.隐藏标签 ...
- boostrapt的二级下拉菜单
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <meta conte ...
- Mac python3.6 安装即使用 psycopg2
学习下python调用PostgreSQL数据库 首先需要安装 psycopg2 python3安装: pip install psycopg2-binary 官网地址: https://pypi.o ...
- Transcranial magnetic stimulation (TMS)
Transcranial magnetic stimulation (TMS) Effect of Transcranial Magnetic Stimulation on Free Will Tra ...
- 2017-09-21xlVBA_蒸发SQL循环查询1
'ARRAY("1991","1992","1993","1994","1996","19 ...
- MyEclipse6.5的SVN插件的安装
在线安装 1. 打开Myeclipse,在菜单栏中选择Help→Software Updates→Find and Install; 2. 选择Search for new features to i ...