//禁用浏览器右键 禁用浏览器右键 function forbiddenRightKey() { function nocontextmenu() { var oEvent=window.event||arguments[0]; oEvent.cancelBubble = true oEvent.returnValue = false; return false; } function norightclick(e) { if (window.Event) { if (e.which == 2 || e.which == 3) return false; } else if (event.button == 2 || event.button == 3) { event.cancelBubble = true event.returnValue = false; return false; } } document.oncontextmenu = nocontextmenu; // for IE5+ document.onmousedown = norightclick; // for all others } 层的悬浮和隐藏 悬浮隐藏某DIV //悬浮某DIV function popupDiv(div_id) { var div_obj = $("#"+div_id); var windowWidth = document.body.clientWidth; var windowHeight = document.body.clientHeight; var popupHeight = div_obj.height(); var popupWidth = div_obj.width(); //添加并显示遮罩层 $("<div id='mask'></div>").addClass("mask") .width(windowWidth ) .height(windowHeight) .appendTo("body") .fadeIn(1); div_obj.css({"position": "absolute"}) .css("z-index","9999") .animate({left: windowWidth/2-popupWidth/2, top: windowHeight/2-popupHeight/2, opacity: "show" }, "slow"); } //隐藏某DIV function hideDiv(div_id) { $("#mask").remove(); $("#" + div_id).animate({left: 0, top: 0, opacity: "hide" }, "slow"); } 转载于:https://www.cnblogs.com/yuiely/archive/2009/09/04/1560328.html