| 1 |
<html> |
| 2 |
<head> |
| 3 |
<script src="jquery-1.4.2.js"></script> |
| 4 |
<script src="jquery.hotkeys.js"></script> |
| 5 |
</head> |
| 6 |
|
| 7 |
<body> |
| 8 |
<input type="button" id="bindCtrlS" value="bind ctrl+s" /> |
| 9 |
<input type="button" id="unBindCtrlS" value="unbind ctrl+s" /> |
| 10 |
<script> |
| 11 |
function bindCtrlS(){ |
| 12 |
jQuery(document).bind('keydown', 'ctrl+s',function (evt){ |
| 13 |
alert("Ctrl+S"); |
| 14 |
return false; |
| 15 |
}); |
| 16 |
} |
| 17 |
|
| 18 |
function unBindCtrlS(){ |
| 19 |
jQuery(document).unbind('keydown', 'ctrl+s'); |
| 20 |
} |
| 21 |
|
| 22 |
$(document).ready(function(){ |
| 23 |
$('#bindCtrlS').bind('click', bindCtrlS); |
| 24 |
$('#unBindCtrlS').bind('click', unBindCtrlS); |
| 25 |
} |
| 26 |
); |
| 27 |
|
| 28 |
</script> |
| 29 |
</body></html> |