forked from zuriby/jquery.hotkeys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-static-07.html
47 lines (41 loc) · 1.57 KB
/
test-static-07.html
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>