飞翔的起点

从这里出发

导航

<2009年7月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

统计

常用链接

留言簿(5)

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜

js判断页面关闭的方法

1、<script language="javascript">

window.onbeforeunload = function()

{

 if(((event.clientX > document.body.clientWidth - 43) && (event.clientY < 23)) || event.altKey) {

  window.event.returnValue = '关闭。';   

 }

}

</script>

2、<script language="javascript">

window.onbeforeunload = function()

{

var n = window.event.screenX - window.screenLeft;

var b = n > document.documentElement.scrollWidth-20;

if(b && window.event.clientY < 0 || window.event.altKey)

{

alert("是关闭而非刷新");

window.open(this.location); 

//return false;

//window.event.returnValue = ""; }

}

</script>


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ajaxchen_615/archive/2009/07/06/4325917.aspx

posted on 2009-07-06 22:17 forgood 阅读(1289) 评论(0)  编辑  收藏 所属分类: javaScript


只有注册用户登录后才能发表评论。


网站导航: