系统没有针对关闭的事件: onunload onbeforeunload 在刷新的时候同样会被触发, 所以只能判断关闭时的一些特殊现象来判断用户是刷新还是关闭:
<script language=javascript>
window.onbeforeunload = function()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
window.event.returnValue = "";
}
}
</script>
<script language=javascript>
window.onbeforeunload = function()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
window.event.returnValue = "";
}
}
</script>
解决方案 »
- 有个框架页面(a.b),如何在框架页面a中打开页面的时候跳转到B页面用JAvacscript如何实现,
- javascript问题,关于window对象。。
- 求这个JQUERY写法
- 急--为什么我装上scriptx后,好象没有factory.printing(即没找到printing的属性)
- 怎样用for循环把这段代码精简?
- 如何用onload加载htm的VML元数
- checkbox的问题:如何删除选中的记录?用checkbox,动态生成的checkbox————急,在线等待
- 如何判断window.open所打开的新窗口已经载入完毕
- 怎样得到选中的内容(文字)呢?100分!!
- 基础问题,Jquery的多条件语法怎么写
- var win="window.open('*.htm','','width=100,height=100');"的问题。
- 如何获取子节点属性
it didn't work on my computer!你的思路和我的一样,希望有不同做法的兄弟不佞赐教。