处理回车事件是否有既兼容ie又兼容火狐的方法

                document.onkeypress = function (e) {
                        var code;
                        if (!e) {
                            var e = window.event;
                        }
                        if (e.keyCode) {
                            code = e.keyCode;
                        }
                        else if (e.which) {
                            code = e.which;
                        }
                        if (code == 13) {
                            document.getElementById("searchButton").click();
                            return false;
                        }
                    }

你可能感兴趣的:(回车事件)