问题描述
解决方案
function isCapslock(e){
e = (e) ? e : window.event;
var charCode = false;
if (e.which) {
charCode = e.which;
} else if (e.keyCode) {
charCode = e.keyCode;
}
var shifton = false;
if (e.shiftKey) {
shifton = e.shiftKey;
} else if (e.modifiers) {
shifton = !!(e.modifiers & 4);
}
if (charCode >= 97 && charCode <= 122 && shifton) {
return true;
}
if (charCode >= 65 && charCode <= 90 && !shifton) {
return true;
}
return false;
}
解决方案二:
http://www.cnblogs.com/xjyggd/archive/2008/10/13/1309662.html
解决方案三:
http://kryogenix.org/code/browser/jscapslock/jscapslock.html
时间: 2024-12-31 07:54:25