页面定时自动刷新禁止右键F12代码
   
           时间:11-04
           作者:
          
        
        采用javascript实现禁止右键和F12查看源代码,这是为了别人不看你的代码,对于不懂得人哦,如果老手是防不住的!禁止F12代码: 	<script type="text/javascript"> 	 	document.onkeyd
        采用javascript实现禁止右键和F12查看源代码,这是为了别人不看你的代码,对于不懂得人哦,如果老手是防不住的!
禁止F12代码:
- <script type="text/javascript">
- document.onkeydown = function () {
- if (window.event && window.event.keyCode == 123) {
- event.keyCode = 0;
- event.returnValue = false;
- return false;
- }
- };
- </script>
禁止右键代码:
- <script language="Javascript">
- document.oncontextmenu=new Function("event.returnValue=false");
- document.onselectstart=new Function("event.returnValue=false");
- </script>
自动刷新代码:
- <script language="JavaScript">
- function re_fresh() {
- window.location.reload();
- }
- setTimeout('re_fresh()',15000); //指定15秒刷新一次
- </script>
方案二
- <script type="text/javascript">
- //屏蔽右键菜单
- document.oncontextmenu = function (event){
- if(window.event){
- event = window.event;
- }try{
- var the = event.srcElement;
- if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
- return false;
- }
- return true;
- }catch (e){
- return false;
- }
- }
- //屏蔽粘贴
- document.onpaste = function (event){
- if(window.event){
- event = window.event;
- }try{
- var the = event.srcElement;
- if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
- return false;
- }
- return true;
- }catch (e){
- return false;
- }
- }
- //屏蔽复制
- document.oncopy = function (event){
- if(window.event){
- event = window.event;
- }try{
- var the = event.srcElement;
- if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
- return false;
- }
- return true;
- }catch (e){
- return false;
- }
- }
- //屏蔽剪切
- document.oncut = function (event){
- if(window.event){
- event = window.event;
- }try{
- var the = event.srcElement;
- if(!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
- return false;
- }
- return true;
- }catch (e){
- return false;
- }
- }
- //屏蔽选中
- document.onselectstart = function (event){
- if(window.event){
- event = window.event;
- }try{
- var the = event.srcElement;
- if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")){
- return false;
- }
- return true;
- } catch (e) {
- return false;
- }
- }
- </script>
