私信  •  关注

CodingbyRaj

CodingbyRaj 最近创建的主题
CodingbyRaj 最近回复了

E.哪个 为您提供ascii值。将ascii转换为字符使用 string.fromCharcode(哪个) .

$(function () {
    $(document).keyup(function (e) {            
        if (String.fromCharCode(e.which) == 1) {
            window.location.href = '/';
        } else if (String.fromCharCode(e.which) == 2) {
            window.location.href = '/escolas';
        } else if (String.fromCharCode(e.which) == 3) {
            window.location.href = '/noticias';
        } else if (String.fromCharCode(e.which) == 4) {
            window.location.href = '/eventos';
        } else if (String.fromCharCode(e.which) == 5) {
            window.location.href = '/contato';
        }
    });
});