1 <p>To test manually, press keys and compare results to other browsers.</p>
3 onclick="log(eventInfo(event));"
4 onmousedown="log(eventInfo(event));"
5 onmouseup="log(eventInfo(event));"
6 onkeypress="log(eventInfo(event));"
7 onkeydown="log(eventInfo(event));"
8 onkeyup="log(eventInfo(event));">
10 <input type=text></input>
15 document.getElementById("log").innerHTML+= msg + "<br />";
17 function eventInfo(event, where) {
21 target = event.srcElement ? event.srcElement : event.target;
22 if (event.type == "textInput")
23 return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type + " - " + event.data
24 + '. Value: "' + target.value + '".';
25 else if (event.type == "keydown" || event.type == "keypress" || event.type == "keyup")
26 return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type
27 + ' - ' + [event.ctrlKey, event.altKey, event.shiftKey, event.metaKey]
28 + ' - ' + event.keyIdentifier
29 + ' - ' + event.keyCode
30 + ' - ' + event.charCode
31 + '. Value: "' + target.value + '".';
32 else if (event.type == "mousedown" || event.type == "click" || event.type == "mouseup")
33 return (where ? "(" + where + ") " : "") + target.tagName + " - " + event.type
34 '. Value: "' + target.value + '".';
40 log("target - type - " + ["ctrlKey", "altKey", "shiftKey", "metaKey"]
41 + ' - ' + "keyIdentifier"
43 + ' - ' + "charCode");
45 if (document.getElementsByTagName("input")[0].addEventListener)
46 document.getElementsByTagName("input")[0].addEventListener('textInput', function(e) {log(eventInfo(e));}, false);
48 document.getElementsByTagName("input")[0].focus();
50 if (window.testRunner) {
51 testRunner.dumpAsText();
53 eventSender.keyDown(" ", []);
55 eventSender.keyDown("\x08", []);
57 eventSender.keyDown("leftArrow", []);
59 eventSender.keyDown("\t", []);