很多时候需要用到js禁止相关的代码:
function prohibit() { ?// 禁止右键 ?$(document).ready(function() { ???$(document).bind("contextmenu", function(e) { ?????return false; ???}); ??????// 禁止a ???$("a").each(function() { ?????$(this).css("cursor", "default"); // 修改鼠标样式 ?????$(this).removeAttr(‘href‘); //移除href 属性 ?????$(this).click(function(event) { ???????event.preventDefault(); // 如果<a>定义了 target="_blank“ 需要这句来阻止打开新页面 ?????}); ???}); ?});}prohibit();
js禁止
原文地址:http://www.cnblogs.com/andyhxl/p/7749707.html