Learn free online HTML5, javascript, and jquery Tutorials by Examples

Wednesday 23 July 2014

ASCII code in javascript

See the Pen Get ASCII code in javascript by satish mallick (@mallick_satish) on CodePen.

------------------------------------------------------
<html>
<head>
<title>ctrlKey example</title>
<script type="text/javascript">
function showChar(e){
 
  var mainval = "Key Pressed: " + String.fromCharCode(e.charCode) + "<br />" + "charCode: " + e.charCode + "<br />" + "CTRL key pressed: " + e.ctrlKey + "<br />";

document.getElementById('values').innerHTML = mainval;
 
}
</script>
</head>
<body onkeypress="showChar(event);">
<p>Press any key, with or without holding down the CTRL key.<br />
You can also use the SHIFT key together with the CTRL key.</p>
</body>
</html>------------------------------------------------------

No comments:

Post a Comment