css文件
body {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;
user-select: none;
}
js文件
//禁止浏览器默认右键菜单
document.oncontextmenu = function(event) {
event.preventDefault();
};
//禁止文本选中
if (document.all) {
document.onselectstart = function() {
return false;
}; //for ie
} else {
document.onmousedown = function() {
return false;
};
document.onmouseup = function() {
return true