F1键进入我的支持页面?

时间:2012-07-03 23:50:59

标签: php javascript hyperlink

  

可能重复:
  Handling key-press events (F1-F12) using JavaScript and jQuery, cross-browser

如何获取我的javascript代码并将其转到我的支持文档?

key['/'] = "support.php";   

function getKey(keyStroke) {
isNetscape=(document.layers);
eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
which = String.fromCharCode(eventChooser).toLowerCase();
for (var i in key) if (which == i) window.location = key[i];
}
document.onkeypress = getKey;

1 个答案:

答案 0 :(得分:1)

正如您在similar question中看到的那样,实现跨浏览器所需的行为几乎是不可能的。您应该使用其他键盘快捷键。