Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

dom key event shift is pressed

<html>
<head>
<title>shiftKey example</title>

<script type="text/javascript">

function showChar(e){
  alert(
    "Key Pressed: " + String.fromCharCode(e.charCode) + "
"
    + "charCode: " + e.charCode + "
"
    + "SHIFT key pressed: " + e.shiftKey + "
"
    + "ALT key pressed: " + e.altKey + "
"
  );
}

</script>
</head>

<body onkeypress="showChar(event);">
<p>Press any character key, with or without holding down
 the SHIFT key.<br />
You can also use the SHIFT key together with the ALT key.</p>
</body>
</html>
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #dom #key #event #shift #pressed
ADD COMMENT
Topic
Name
7+6 =