Window.onkeypress

この記事は技術レビューを必要としています。

この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

Summary

An event handler for the keypress event on the window.

Syntax

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

Example

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

<script>
window.onkeypress = keypress;

function keypress() {
 alert("keypress event detected!");
}
</script>

</head>
<body>
<p>press and release any key to fire the keypress event.</p>
</body>
</html>

Notes

The keypress event is raised when the user presses and releases any key on the keyboard.

  • Under FF 1.0.5.4 this event fires before the keyup event is detected, i.e. it appears to work exactly like onkeydown.

Specification

Not part of specification.

Document Tags and Contributors

Contributors to this page: Sheppy, LibreGeekingKid, ethertank, Rappo, Jabez, kscarfone, teoli
最終更新者: teoli,
サイドバーを隠す