Last change
on this file since 528 was
483,
checked in by hendrikvanantwerpen, 11 years ago
|
Added Dojo 1.9.3 release.
|
File size:
802 bytes
|
Line | |
---|
1 | <html> |
---|
2 | <head> |
---|
3 | <title>dojo/on keypress/keydown test</title> |
---|
4 | <script src="../../dojo.js"></script> |
---|
5 | <script> |
---|
6 | require(["dojo/dom", "dojo/on", "dojo/domReady!"], |
---|
7 | function(dom, on){ |
---|
8 | on(dom.byId("textbox"), "keypress, keydown, compositionend", function(evt){ |
---|
9 | console.log(evt.type + |
---|
10 | ("keyCode" in evt ? " keyCode = " + evt.keyCode : "") + |
---|
11 | ("charCode" in evt ? " charCode = " + evt.charCode : "") |
---|
12 | ); |
---|
13 | |
---|
14 | // stop Ctrl-W from closing the browser window, etc. |
---|
15 | evt.preventDefault(); |
---|
16 | evt.stopPropagation(); |
---|
17 | }); |
---|
18 | }); |
---|
19 | </script> |
---|
20 | </head> |
---|
21 | <body> |
---|
22 | <h1>dojo/on keypress/keydown test</h1> |
---|
23 | |
---|
24 | <p> |
---|
25 | Test how browsers fire keydown and keypress events |
---|
26 | </p> |
---|
27 | |
---|
28 | <p> |
---|
29 | Type into <input>, and watch console for log messages. |
---|
30 | </p> |
---|
31 | <input id="textbox"> |
---|
32 | </body> |
---|
33 | </html> |
---|
Note: See
TracBrowser
for help on using the repository browser.