日期:2014-05-20  浏览次数:20803 次

在页面怎么用JS捕获机顶盒的遥控器按了什么键???
在页面怎么用JS捕获机顶盒的遥控器按了什么键???在页面怎么用JS捕获机顶盒的遥控器按了什么键???
------解决方案--------------------
进来学习了
------解决方案--------------------
document.onkeypress = grabEvent;
    document.onsystemevent = grabEvent;
    document.onkeypress = grabEvent;
    document.onirkeypress = grabEvent;
    function grabEvent() {
        var key_code = event.which;
     
        switch (key_code) {
            case 1: //up
            case 269:
                menuFocus(-1);
              
                return 0;
                break;
            case 2: //down
            case 270:
                menuFocus(1);
             
                return 0;
                break;
            case 3: //left
            case 271:
                menuFocus(-5);
              
                return 0;
                break;
            case 4: //right
            case 272:
                menuFocus(5);
              
                return 0;
                break;
            case 13:
                return 0;
                break;
            case 340: //back
            case 283:
                return 0;
                break;
            case 372: