javaScript阻止瀏覽器F5刷新

 1 <script type="text/javascript">
 2    //禁止用F5鍵 
 3    document.onkeydown = function (e) {
 4      var ev = window.event || e;
 5      var code = ev.keyCode || ev.which;
 6      if (code == 116) {
 7           ev.keyCode ? ev.keyCode = 0 : ev.which = 0;
 8           cancelBubble = true;
 9           return false;
10      }
11    } 
12   //禁止右鍵刷新
13   document.oncontextmenu=function(){return false};
14</script>
相關文章
相關標籤/搜索