Heim >Web-Frontend >js-Tutorial >常用JS代码实例小结_javascript技巧
1. 键盘方向键监听事件和禁止复制操作
<head> <script language=javascript> document.onkeydown=nextpage var prevpage="http://www.jb51.net/1.htm" var nextpage="http://www.jb51.net/2.htm" var indexpage="/readindex/index_0011020986.html" function nextpage(event) { event = event ? event : (window.event ? window.event : null); if (event.keyCode==13) location=indexpage if (event.keyCode==37) location=prevpage if (event.keyCode==39) location=nextpage } </script> <SCRIPT language=javascript> function nocopy() { alert("不允许复制"); event.returnValue=false; } </SCRIPT> </head> <body leftmargin="0" oncopy=nocopy()> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <h1>禁止复制</h1> </body>
jquery表操作实例,本来想加在留言中,但是javaeye的管理员很莫名其妙的老是隐藏我的帖子,帖子发了不到一分钟就被评委隐藏贴,我真佩服啊,暗箱操作换说是被大家评为隐藏贴,呵呵呵,我哪里发了垃圾贴了,我上午把prototype的lightboxhuanchengjquery的facybox所以发个帖子,谁知就直接评委隐藏贴了,难不成发那种感情贴就可以不隐藏,发技术贴就被隐藏!!!!
复制代码 代码如下:
//泰国气候中的表的渲染
BEUI.E.thailand_QH = function(){
//tbody中第一列居左 , 第3,5,7列字体加粗
$('table#thailand-qh tbody tr').each(function(){
$('td:even',this).css('font-weight','bold');
$('td:eq(0)',this).css({'text-align':'left','font-weight':'normal'});
});
$('table#thailand-qh tbody tr:odd').addClass('thailand-qh-tbody-tr-odd');
$('table#thailand-qh tbody tr:even').addClass('thailand-qh-tbody-tr-even');
};