【www.gdgbn.com--jquery】

键盘按键

$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});

有一点区别

$("body").bind("selectstart",function(){return false;});

如果要在firfox也禁止复制的话就可以用

body { 
   -moz-user-focus:   ignore; 
   -moz-user-select:   none; 
}

来定义了

下面提供一些禁止键盘按键代码。

function key() {
if (event.shiftkey) {
window.close();
}

禁止了选取内容

 

var omitformtags = ["input", "textarea", "select"]

omitformtags = omitformtags.join("|")

function disableselect(e) {
if (omitformtags.indexof(e.target.tagname.tolowercase()) == -1)
return false
}

function reenable() {
return true
}

if (typeof document.onselectstart != "undefined")
document.onselectstart = new function("return false")
else {
document.onmousedown = disableselect
document.onmouseup = reenable
}

本教程所有函数参考

.ready( handler )
handlera function to execute after the dom is ready.


(document).ready()是如何实现的

if ( jquery.browser.msie && window == top ) (function(){  2     if (jquery.isready) return;  3     try {  4            document.documentelement.doscroll("left");  5       } catch( error ) {  6       settimeout( arguments.callee, 0 );  7        return;  8     }  9    // and execute any waiting functions 10    jquery.ready(); 11 })(); 12 13 ……14 15 jquery.event.add( window, "load", jquery.ready );

本文来源:http://www.gdgbn.com/wangyezhizuo/27941/