可以用程序给每一个连接填加一个onclick事件。

解决方案 »

  1.   

    <script for=document event=onclick> 
    if(event.srcElement.tagName == "A" && event.srcElement.href != "")alert("是关闭不是刷新"); 
    </script>
      

  2.   

    <button onclick="javascript:location.href='http://www.baidu.com/?b';">ok</button>
    <button onclick="javascript:location.replace('http://www.baidu.com/?b');">ok</button>
    如果跳转上上面的代码,就不行了。
    该怎么弄呢?
      

  3.   

    或者是下面这样的
    <input onclick="javascript:location.href='http://www.baidu.com/?b';" type=button value="test">
    <input onclick="javascript:location.href='http://www.baidu.com/?b';" value="test">
    还有这样类似这样的:
    <input onclick="test()" type=button value="test">
    <script>founction test(){location.href='http://www.baidu.com/?b';}</script>
    最后就是在form中action,submit提交的,
    这些都可以导致转到其他页面
      

  4.   

    主要是浏览器没有专门判断关闭的特有事件(onunload在刷新也会被触发),所以这个问题比较难,只好根据关闭浏览器的一些特征加以判断,比如用ALT+F4,比如点击X关闭:
    <script language="javascript">
    window.onbeforeunload = function()  //author: meizz
    {
      var n = window.event.screenX - window.screenLeft;
      var b = n > document.documentElement.scrollWidth-20;
      if(b && window.event.clientY < 0 || window.event.altKey)
      {
        window.event.returnValue = "";  //这里可以放置你想做的操作代码
      }
    }
    </script>
      

  5.   

    http://www.blogjava.net/TrampEagle/archive/2006/01/06/26829.html