Debian Codegraph @

test-static-02.html

raw
1
2 <html>
3 <head>
4 <style>
5 * {font-family: mono; font-size:0.95em}
6 .eventNotifier{width: 100px; float: left; color:navy; border: dotted 1px navy; padding: 4px; background-color:white; margin:3px}
7 .dirty{border: solid 1px #0ca2ff; color:white; background-color:#0ca2ff}
8
9 </style>
10 </head>
11 <body>
12 <h3>Test #01</h3>
13 <input type='text' id='input_01'/>
14 <p>
15 type 'ctrl+l ' to focus.<br/>
16 type 'shift+3' to insert 'Shift#' into the text box.<br/>
17 type 'a' inside the textbox and have 'b' inserted instead.
18 </p>
19 <hr />
20 <h3>Test #02</h3>
21 <table>
22 <tbody>
23 <tr>
24 <td><input type='text' id='input_02' class='foo'></td>
25 </tr>
26 <tr>
27 <td><input type='text' id='input_03' class='foo'></td>
28 </tr>
29 <tr>
30 <td><input type='text' id='input_04' class='foo'></td>
31 </tr>
32 <tr>
33 <td><input type='text' id='input_05' class='foo'></td>
34 </tr>
35 <tr>
36 <td><input type='text' id='input_06' class='foo'></td>
37 </tr>
38 </tbody>
39 </table>
40 <input type='button' value='UnBind Click' onclick="unbindClick()" />
41 <input type='button' value='UnBind Keyup' onclick="unbindKeyup()" />
42 </body>
43 <hr />
44 <div id="logger"></div>
45 <script src="jquery-1.4.2.js"></script>
46 <script src="jquery.hotkeys.js"></script>
47 <script>
48 $(document).ready(function(){
49 $(document).bind('keydown', 'ctrl+l', function(){$('#input_01')[0].focus();})
50 .bind('keydown', 'shift+#', function(){$('#input_01')[0].value = "Shift#";})
51 //.bind('keyup', function () { alert (arguments); })
52 .bind('click', function (event){
53 if (event.target == $('html')[0]){
54 alert("save the planet, don't waste energy over meaningless clicking");
55 }
56 });
57
58 $('#input_01').bind('keyup', 'a', function(event){
59 this.value = this.value.replace(/a/g, "b");
60 });
61
62 $('input.foo').bind('keydown', 'ctrl+k', function(event){
63 log('binding keydown/ctrl+k to <b>input</b> applied on <b>#' + event.target.id + '</b>');
64 return false;
65 });
66
67 $('table').bind('keydown click keyup', 'ctrl+l', clickHandler);
68 });
69
70 function clickHandler(event){
71 log('binding ' + event.type + ' with(ctrl+l) to <b>table</b> applied on <b>#' + event.target.id + '</b>');
72 return false;
73 }
74
75 function unbindClick(){
76 $('table').unbind('click', clickHandler).unbind('keyup', 'ctrl+l', clickHandler);
77 }
78
79 function unbindKeyup(){
80 $('table').unbind('keyup', 'ctrl+l', clickHandler);
81 }
82
83
84 function log(msg){
85 $('#logger').html(msg);
86 }
87 </script>
88 </html>