📄 key-updown.js
字号:
// specify KEYDOWN and KEYUP event-handlers
window.document.onkeydown = isdown;
window.document.onkeyup = isup;
// a function to react to KEYDOWN events
function isdown()
{
window.document.getElementById("bulb").src="on.gif";
document.getElementById("txt").value = "Key is Down";
}
// a function to react to KEYUP events
function isup()
{
window.document.getElementById("bulb").src="off.gif";
document.getElementById("txt").value = "Key is Up";
}
/* the second statement in each function deliberately omits the optional 搘indow.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -