JS禁止使用Enter键

//禁用Enter键
document.onkeydown = function (e) {
    //捕捉回车事件
    var ev = (typeof event != 'undefined') ? window.event : e;
    if (ev.keyCode == 13 || event.which == 13) {
        return false;
    }
}

猜你喜欢

转载自www.cnblogs.com/dzw159/p/11277317.html