屏蔽鼠标右键和F5

 

屏蔽F5和右键

<script type="text/javascript">
       
        function document.onkeydown() {
            if (event.keyCode == 116) {
                event.keyCode = 0;
                event.cancelBubble = true;
                return false;
            }
        }

        document.oncontextmenu = function (e) {
            return false;
        }

       
    </script> 


//屏蔽鼠标右键

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>屏蔽键盘鼠标部分功能</title>
<style>
body{
 margin:0;
 padding:0;
}
#do{
 width:100%;
 border-top:1px solid #f00;
 /*border-bottom:1px solid #f00;*/
}
</style>
</head>

<body id="do">1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />


<script>
addDOMLoadEvent(function(){
 shielded();
});
var shielded = function(){
 if(document.getElementById("do").clientHeight > document.documentElement.clientHeight)
 {
  document.getElementById("do").style.height = document.getElementById("do").clientHeight;
 }
 else{
  document.getElementById("do").style.height= document.documentElement.clientHeight+"px";
 }
 var myName = document.getElementById("do");
 /*myName.onmouseup = function(){
  return false;
 }
 myName.ondragstart = function(){
  return false;
 }*/
 myName.oncontextmenu = function(){
  return false;
 }
 /*myName.οnmοusemοve= function(){
  return false;
 }
 myName.οncοpy= function(){
  return false;
 }
 myName.onselectstart = function(){
  return false;
 }
 myName.onselect = function(){
  return false;
 }
 myName.onmousedown = function(){
  return false;
 }*/
}
function addDOMLoadEvent(func) {
    if (!window.__load_events) {
       var init = function () {
           // quit if this function has already been called
           if (arguments.callee.done) return;
           // flag this function so we don't do the same thing twice
           arguments.callee.done = true;
           // kill the timer
           if (window.__load_timer) {
               clearInterval(window.__load_timer);
               window.__load_timer = null;
           }
           // execute each function in the stack in the order they were added
           for (var i=0;i < window.__load_events.length;i++) {
              window.__load_events[i]();
           }
           window.__load_events = null;
       };
       // for Mozilla/Opera9
       if (document.addEventListener) {
           document.addEventListener("DOMContentLoaded", init, false);
       }
     
       // for Internet Explorer
       /*@cc_on @*/
       /*@if (@_win32)
           document.write("<scr"+"ipt id=__ie_onload defer src=//0><\/scr"+"ipt>");
           var script = document.getElementById("__ie_onload");
           script.onreadystatechange = function() {
               if (this.readyState == "complete") {
                   init(); // call the onload handler
               }
           };
       /*@end @*/
     
       // for Safari
       if (/WebKit/i.test(navigator.userAgent)) { // sniff
           window.__load_timer = setInterval(function() {
               if (/loaded|complete/.test(document.readyState)) {
                   init(); // call the onload handler
               }
           }, 10);
       }
       // for other browsers
       window.onload = init;
       // create event function stack
       window.__load_events = [];
    }
    // add function to event stack
    window.__load_events.push(func);

</script>
</body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值