The javascript implementation captures the keys pressed on the keyboard

  • 2020-06-07 03:57:13
  • OfStack

Little demo, using js to capture that key on the keyboard, then displays the corresponding code value


<!DOCTYPE html>
<html>
<head>
<script>
function showKeyCode(event)
{
document.getElementById("result").value= event.keyCode;
}
 
</script>
</head>
 
<body onkeyup="showKeyCode(event)">
<p> Press the key on the keyboard and the corresponding text box will be displayed code</p>
<input type="text" id="result" value="1" />
</body>
 
</html>

This is the end of this article, I hope you enjoy it.


Related articles: