How can I detect a client-side capsLock keypress...I have tried creating the following function that I wanted to launch when a key is pressed
<script type="text/javascript" language="javascript">
function changeCapsLock(e) {
if (typeof capsLockON != 'undefined' && e.keyCode == 20) {
capsLockON = !capsLockON;
displayMsg();
}
}
//Display the message if CapsLocks is ON, otherwise conceal the message
function displayMsg() {
if (capsLockON)
document.getElementById('divCapsWarning').style.visibility = 'visible';
else
document.getElementById('divCapsWarning').style.visibility = 'hidden';
}
}
</script>
</head>
<body onkeydown="changeCapsLock(event)">
but the onkeydown event does not fire when the CapsLock is pressed?