We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

window.onkeydown Redirect 1


An event handler for the keydown event on the window.


window.onkeydown = funcRef;
  • funcRef is a reference to a function.


window.onkeydown = doFunc;
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<title>onkeydown test</title>

window.onkeydown = keydown;

function keydown() {
  alert("keydown event detected!");

<p>press and hold down any key to fire the keydown event.</p>


The keydown event is raised when the user presses any key.


Not part of specification.

Document Tags and Contributors

 Last updated by: Sheppy,