Created
August 1, 2014 10:36
-
-
Save pluswave/606f1002dcca6fdc5f00 to your computer and use it in GitHub Desktop.
not work on chromium, but works on firefox (however, keyCode is wrong)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC | |
"-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<title>DocumentKeyTest</title> | |
<script> | |
function load(){ | |
var body = document.getElementById("body") | |
body.addEventListener("keypress", keypress); | |
function keypress(e) | |
{ | |
document.getElementById("p1").innerHTML = "key press " + e.keyCode; | |
} | |
} | |
</script> | |
</head> | |
<body id="body" onload="load()" > | |
<h1>DocumentKeyTest</h1> | |
<div id="p1"> | |
</div> | |
<div id="p2"> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment