处理回车事件是否有既兼容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;
                        }
                    }

posted on 2011-08-11 11:10  张扬个性,敢为天下先  阅读(206)  评论(0编辑  收藏  举报