Why is always UpperCase in my code?

<script type="text/javascript" src="jquery-1.3.2.js"></script>
<input id=a type="text" value='sss'/>
<script type="text/javascript">
    $('#a').keyup(
  function(event){
   alert(String.fromCharCode(event.which))
  })
</script>

you can test this code in your browser,

and it always warns uppercase character code.

+5
source share
2 answers

At first I thought it was a mistake, since the expected lowercase value is returned for the event keypress. It turns out that the keyup/keydownASCII uppercase / unbiased version of the key always returns.

Using this link: http://www.javascriptkit.com/jsref/eventkeyboardmouse.shtml

keyCode onkeydown onkeyup, , , "Shift". , "Shift + a" keyCode "A", keyCodes , "Shift" "" . keyCode "a", , keyCode

  • Shift + a keypress.
  • Shift + a keydown keyup .
  • keypress .
  • keydown keyup .

: - a key code 65. 65 - A ASCII. , - a (ASCII- 97), A, keydown/keyup . , ?

+9

()

, . , .

+1

All Articles