我使用这个 jquery https://github.com/tzuryby/jquery.hotkeys作为热键。
请,我怎么能称之为“添加”功能:
<script type = "text/javascript" >
function add(int) {
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("add").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "method.php?a=" + int, true);
xmlhttp.send();
}
</script>
例如,我需要调用添加 javasctipt,而不是警报:
<script src="jquery-1.4.2.js"></script>
<script src="jquery.hotkeys.js"></script >
<script>
$(document).bind('keydown', 'ctrl + k', function() {
alert('Teskt hotkey!');
// I need processing javasctipt named "add", not alert
});
</script>