Thats real a problem. Javascript so also construct can only check capslock, when you press another key.
Because it only can check keycodes.
This would be look like this in javascript, you see you cant directly:
$('#example').keypress(function(e) {
var s = String.fromCharCode( e.which );
if ( s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey ) {
alert('caps is on');
}
});
[/code:zh4blxce]