Veeery 基本问题,但我无法找到一个简单的答案(而且我不知道我在做什么,目前没有时间正确学习 javascript 或原型(prototype) :-/)。
我正在尝试重新使用 this bit of code它甚至可以完全按照我的意愿行事 ;),只是我不知道如何更改这部分:
function init() {
Event.observe(document.body, 'mousemove', resetIdle, true);
setIdle();
}
我希望它不仅能观察“mousemove”,还能同时观察“keydown”。我该怎么做?
最佳答案
function init() {
Event.observe(document.body, 'mousemove', resetIdle, true);
Event.observe(document.body, 'keydown', resetIdle, true);
setIdle();
}
很明显,不是吗?
关于javascript - 原型(prototype)(Javascript): How do I observe multiple events for the same element?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5050839/