It seems to me that you answered your question. If you find the SHIFT key, you can easily distinguish between capital and lowercase letters:
if(e.shiftKey){ alert("You pressed a CAPITAL letter with the code " + e.keyCode); }else{ alert("You pressed a LOWERCASE letter with the code " + e.keyCode); }
Or I do not understand your question?
Update . Uppercase ASCII codes can easily be converted to lowercase ASCII codes by adding 32, so all you have to do is the following:
<html> <head> <title>Test</title> <script type="text/javascript"> function showChar(e){ if(e.keyCode!=16){ </script> </head> <body onkeydown="showChar(event);"> <p>Press any character key, with or without holding down the SHIFT key.<br /></p> </body> </html>
Update 2: Try the following:
<html> <head> <title>Test</title> <script type="text/javascript"> function showChar(e){ if(e.keyCode!=16){ </script> </head> <body onkeydown="showChar(event);"> <p>Press any character key, with or without holding down the SHIFT key.<br /></p> </body> </html>
Computerish
source share