/*倒计时 var countdown=(function(){ return function(){ var showTime = document.getElementById(this.id), beginNum=60, oril=showTime.innerHTML, string="%t%u79d2u540eu53efu91cdu65b0u64cdu4f5c", t; var showDown=function(){ if(beginNum>0){ beginNum-=1; showTime.innerHTML = string.replace("%t%",beginNum); showTime.disabled="disabled"; }else{ showTime.innerHTML =oril; clearInterval(t); showTime.disabled=""; } }; t=setInterval(showDown,1000); }; })(); */ (function($) { $.fn.countdown = function(options) { var opts = $.extend(true, {}, $.fn.countdown.defaults, options); return this.each(function() { var $this = $(this); var t,beginNum=60,oril=$this.html(), string="%t%u79d2u540eu53efu91cdu65b0u64cdu4f5c"; function countdown(){ return function(e){ var origNum=beginNum; $this.html(string.replace("%t%",beginNum)); $this.addClass("getCodeOff"); $this.attr("disabled",true); var showDown=function(){ if(beginNum>0){ beginNum-=1; $this.html(string.replace("%t%",beginNum)); }else{ beginNum=origNum; $this.html(oril); $this.removeClass("getCodeOff"); $this.attr("disabled",false); clearInterval(t); } }; t=window.setInterval(showDown,1000); }; }; $this.on("click",countdown()); }); }; $.fn.countdown.defaults = { }; })(jQuery);