Javascript 如何使用javascript禁用鼠标右键单击和ctrl+v & ctrl+c按键
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10909365/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to disable mouse right click and ctrl+v & ctrl+c keypress using javascript
提问by Riya
Possible Duplicate:
How do I disable right click on my web page?
可能的重复:
如何禁用我的网页上的右键单击?
I want to disable right click and Ctrl+V& Ctrl+Ckeypresses on a web page using javascript. I have a page where customers has to enter the enquiry details. I don't want them to copy some data and paste it in some fields. Anyone pls help me
我想使用 javascript 在网页上禁用右键单击和Ctrl+ V& Ctrl+C按键。我有一个页面,客户必须在其中输入查询详细信息。我不希望他们复制一些数据并将其粘贴到某些字段中。任何人请帮助我
回答by Vinod
Try this:
尝试这个:
Check this link Disabling-the-right-click-on-web-page
检查此链接禁用右键单击网页
<script language="javascript">
document.onmousedown=disableclick;
status="Right Click Disabled";
Function disableclick(e)
{
if(event.button==2)
{
alert(status);
return false;
}
}
</script>