<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body> <div style="width:100px; height:100px; background:#09C;" </body> <script type="text/javascript"> //F5 document.documentElement.onkeydown=function(e){ e=e||window.event; if(e.keyCode==116){ if(e.returnValue){ e.returnValue=false; }else{ e.stopPropagation(); } return false; } } //右键 document.documentElement.oncontextmenu=function(e){ e=e||window.event; e.cancelBubble = true; e.returnValue=false; return false; } </script> </html>
没有测试
JS 禁止刷新和右键
时间: 2024-10-31 04:10:00