在 body 标签中使用 onUnload 事件。
解决方案 »
- iframe parent.location.reload 问题
- 滚动条定位
- iframe引用的页内window.onload事件处理中取window.documentElement.clientHeight值的诡异现象!
- 今天用jsEclipse写脚本,用紫光拼音V6时崩溃了两次。求在Eclipse平台下稳定的输入法
- 如何直接关闭Win2000自带的IE的窗口?即IE5.01
- 含变量的正则表达式怎么写?
- 关于鼠标指向链接时的显示菜单模式的修改
- 怎样改变最小化的WEB页面的图标?很难吧?
- 一组text的name属性相同,如何取值?
- node.js var router = express.Router(); TypeError: express.Router is not a functi
- 如何利用js实现助记码的功能
- 关于DOM的求助?
if(window.closed==true){
alert("是窗口关闭,不是刷新,跳转");
window.location.href="目标.php";
}else{
alert("是刷新,什么都不作");
}
}但是试验之 window.closed 始终为false 如果解决了这个条件问题 应该就可以了
看看对你有没有帮助!
if(event.clientX<=0){ //>0是刷新,<=0是关闭当前页
alert("是窗口关闭,不是刷新,跳转");
window.location.href="目标.php";
}else{
alert("是刷新,什么都不作");
}
}
var isUnloadPage = false;
function window.onbeforeunload()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
window.event.returnValue = "";
isUnloadPage = true;
}
}
function window.onunload()
{
if(isUnloadPage) window.open("m.htm");
}
</script>