且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

按下空格键后执行JS代码

更新时间:2023-12-02 23:53:28

document.body.onkeyup = function(e){
    if(e.keyCode == 32){
        //your code
    }
}

这将在您按下空格键后执行.

This will be executed after you hit spacebar.

JSFiddle .