OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 | 4 |
5 function keyevent(event) { | 5 function keyevent(event) { |
6 var p = document.createElement("p"); | 6 var p = document.createElement("p"); |
7 p.appendChild(document.createTextNode(event.type + " - key: " + event.keyIde
ntifier + "@" + event.keyLocation + " (keyCode/charCode: " + event.keyCode + "/"
+ event.charCode + ")" + " modifiers: " + event.ctrlKey + "," + event.altKey +
"," + event.shiftKey + "," + event.metaKey)); | 7 p.appendChild(document.createTextNode(event.type + " - key: " + event.keyIde
ntifier + "@" + event.location + " (keyCode/charCode: " + event.keyCode + "/" +
event.charCode + ")" + " modifiers: " + event.ctrlKey + "," + event.altKey + ","
+ event.shiftKey + "," + event.metaKey)); |
8 document.getElementById("result").appendChild(p); | 8 document.getElementById("result").appendChild(p); |
9 } | 9 } |
10 | 10 |
11 function init() { | 11 function init() { |
12 var input = document.getElementById("testinput"); | 12 var input = document.getElementById("testinput"); |
13 input.addEventListener("keydown", keyevent, true); | 13 input.addEventListener("keydown", keyevent, true); |
14 input.addEventListener("keypress", keyevent, true); | 14 input.addEventListener("keypress", keyevent, true); |
15 input.addEventListener("keyup", keyevent, true); | 15 input.addEventListener("keyup", keyevent, true); |
16 | 16 |
17 if (window.testRunner) | 17 if (window.testRunner) |
(...skipping 11 matching lines...) Expand all Loading... |
29 <form> | 29 <form> |
30 <input type="text" size="50" id="testinput" /> | 30 <input type="text" size="50" id="testinput" /> |
31 <input type="text" size="50" /> | 31 <input type="text" size="50" /> |
32 </form> | 32 </form> |
33 | 33 |
34 <p>This tests that DOMKeyboardEvents are created correctly in the JavaScript
API.</p> | 34 <p>This tests that DOMKeyboardEvents are created correctly in the JavaScript
API.</p> |
35 | 35 |
36 <div id="result"></div> | 36 <div id="result"></div> |
37 </body> | 37 </body> |
38 </html> | 38 </html> |
OLD | NEW |