Javascript屏蔽IE和Firefox浏览器默认按键响应(快捷键功能)

function stopDefault( e ) {
   // Prevent the default browser action (W3C)
   if ( e && e.preventDefault )
      e.preventDefault();
   else
   // A shortcut for stoping the browser action in IE
      window.event.returnValue = false;
   return false;
}
需要在按键事件中调用上面的函数,即可进行屏蔽,例:
if(e.code!=8)
       keyValue = kc.get(e.code);
else
       backspace(e);
posted @ 2012-03-24 21:20  与时俱进  阅读(1390)  评论(0编辑  收藏  举报
友情链接:同里老宅院民居客栈