防止复制粘贴选项

编程入门 行业动态 更新时间:2024-10-26 21:25:23
本文介绍了防止复制粘贴选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我正在创建一个文档管理系统。这是客户的要求。 1)当我们点击创建链接时,文档应该在浏览器中打开 - 完成 2)防止从某些外部文档复制并粘贴到系统文件 - 防止右键单击和cntrl c反之亦然 3)应用程序中的复制/粘贴应该可用.--请指导我最后一点如何进行此操作。

解决方案

防止右键单击...

< script > var isNS =(navigator.appName ==Netscape)? 1:0; if(navigator.appName ==Netscape)document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP); 函数mischandler(){返回false; } 函数mousehandler(e){ var myevent =(isNS)? e:事件; var eventbutton =(isNS)? myevent.which:myevent.button; if((eventbutton == 2)||(eventbutton == 3))return false; } document.oncontextmenu = mischandler; document.onmousedown = mousehandler; document.onmouseup = mousehandler; < / script >

身体标签

< body oncontextmenu =return falseonselectstart =return falseöndragstart=return false>< / body>

单独防止复制和粘贴 java脚本中的

function killCopy(e){ return false } function reEnable(){ return true } document.onselectstart = new 功能( return false) if ( window.sidebar){ document.onmousedown = killCopy document.onclick = reEnable }

in html body标签 ondragstart =return falseonselectstart =return falseoncontextmenu =return false

Hi All, I am creating a Document Management System.Below are the requirment from the client. 1) When we click on create link a document should get open within the browser - Done 2) Prevent copy from some external document and paste in the document of the system - Prevented right click and cntrl c and vice versa 3) Copy/Paste within the application should be available.-- Please guide me on the last point how to go ahead of this.

解决方案

To Prevent right Click ...

<script> var isNS = (navigator.appName == "Netscape") ? 1 : 0; if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP); function mischandler(){ return false; } function mousehandler(e){ var myevent = (isNS) ? e : event; var eventbutton = (isNS) ? myevent.which : myevent.button; if((eventbutton==2)||(eventbutton==3)) return false; } document.oncontextmenu = mischandler; document.onmousedown = mousehandler; document.onmouseup = mousehandler; </script>

At body tag

<body oncontextmenu="return false" onselectstart="return false" öndragstart="return false"></body>

To Prevent Copy and Paste alone in java script

function killCopy(e){ return false } function reEnable(){ return true } document.onselectstart=new Function ("return false") if (window.sidebar){ document.onmousedown=killCopy document.onclick=reEnable }

in html body tag ondragstart="return false" onselectstart="return false" oncontextmenu="return false"

更多推荐

防止复制粘贴选项

本文发布于:2023-11-25 01:26:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627750.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!