【发布时间】:2011-08-28 01:57:26
【问题描述】:
由于某种原因,该脚本在 Firefox 中无法运行:
document.onkeydown=function keypress(e) {
if (e.keyCode == 27) {
window.location = "/edit"
};
};
它在 Chrome 中运行良好,但由于某种原因它在 Firefox 中无法运行。
基本上,它的作用是在您按下退出键时加载/edit 页面。
【问题讨论】:
-
在 FF5 中为我工作:jsfiddle.net/Tm2PZ
-
尝试运行
console.log(e)。检查输出以检查是否发生了某些事情。
标签: javascript firefox keypress esc-key