ITeye博客

js在html禁止右键的方法

maria3905 · 2015-06-01 11:00 · js · Web前端 · Markdown

在html页面引入js

<script type="text/javascript" src="${contextPath}js/common/preventCopy.js"></script>

document.oncontextmenu = function(){
return false;
}
document.onkeydown = function(){
if (event.ctrlKey && window.event.keyCode==67){
return false;
}
}
document.body.oncopy = function (){
return false;
}
document.onselectstart = function(){
//return false;
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。