设置按钮不能连续点击并触发点击事件
翻页的时候在没有完全翻到下一页不允许再点击下一页按钮 这样避免页码和内容对应不上
FrequentClickHandle("btn",function(){ console.log(new Date().toLocaleString()); },2000); function FrequentClickHandle(domId, callback,timeoutTime) { var button = { enable: true, click: function (callback) { if (this.enable == true) { this.enable = false; callback(); setTimeout(active, timeoutTime); } } } var elem = document.getElementById(domId); elem.addEventListener("click", bind(button, "click", callback), false); function bind(context, name, callback) { return function () { return context[name].apply(context, [callback]); }; } function active() { button.enable = true; } }