繁体   English   中英

如何向右移动光标焦点。 在 JavaScript 中使用箭头键向左、向上和向下

[英]How to move cursor focus right. left , up and down using arrow keys in JavaScript

我想在 JavaScript 中使用箭头键向右、向左、向上和向下移动焦点。

我能够使用 JavaScript 实现正确的功能。

这会帮助你。

$(document).keydown(

    function(e)
    {    
        if (e.keyCode == 37) {      
            $(".tab:focus").prev().focus();

        }
        if (e.keyCode == 38) {      
            //code for up key   
        }
        if (e.keyCode == 39) {      
            $(".tab:focus").next().focus();

        }
        if (e.keyCode == 40) {      
            //code for down key
        }

    }
);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM