File: test-static-07.html

package info (click to toggle)
libjs-jquery-hotkeys 0~20130707%2Bgit2d51e3a9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 176 kB
  • ctags: 26
  • sloc: makefile: 21
file content (47 lines) | stat: -rw-r--r-- 1,609 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<html>
    <head>
        <!-- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> -->
        <!-- <script src="jquery-1.3.2.min.js"></script> -->
        <script src="jquery-1.7.1.js"></script>
        <script src="jquery.hotkeys.js"></script>
    </head>

    <body>
        <input type="button" id="bindCtrlS" value="bind ctrl+s" />
        <input type="button" id="unBindCtrlS" value="unbind ctrl+s" />
        <hr />
        <input type="button" id="bindCtrlH" value="bind ctrl+h" />
        <input type="button" id="unBindCtrlH" value="unbind ctrl+h" />
        <script>
            function bindCtrlS(){
                jQuery(document).bind('keydown.ctrl_s', function(evt){
                    alert("Ctrl+S");
                    return false;
                });
            }

            function unBindCtrlS(){
                jQuery(document).unbind('keydown.ctrl_s');
            }

            function bindCtrlH(){
                jQuery(document).bind('keydown.ctrl_h', function(evt){
                    alert("Ctrl+H");
                    return false;
                });
            }

            function unBindCtrlH(){
                jQuery(document).unbind('keydown.ctrl_h');
            }

            $(document).ready(function(){
                $('#bindCtrlS').bind('click', bindCtrlS);
                $('#unBindCtrlS').bind('click', unBindCtrlS);
                $('#bindCtrlH').bind('click', bindCtrlH);
                $('#unBindCtrlH').bind('click', unBindCtrlH);
                }
            );

        </script>
    </body></html>