博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
倒计时
阅读量:7210 次
发布时间:2019-06-29

本文共 1935 字,大约阅读时间需要 6 分钟。

/*倒计时var countdown=(function(){    return function(){    var showTime = document.getElementById(this.id),        beginNum=60,        oril=showTime.innerHTML,        string="%t%\u79d2\u540e\u53ef\u91cd\u65b0\u64cd\u4f5c",        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%\u79d2\u540e\u53ef\u91cd\u65b0\u64cd\u4f5c";        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);

 

转载于:https://www.cnblogs.com/dingyuanxin/p/4120294.html

你可能感兴趣的文章
Android自定义视图二:如何绘制内容
查看>>
Python天天美味(21) - httplib,smtplib
查看>>
第 37 章 ACOS - CLI
查看>>
Lock-Free 编程
查看>>
7.3. 查看命令
查看>>
解决Wamp 开启vhost localhost 提示 403 Forbbiden 的问题!
查看>>
[WinAPI] API 14 [获取、设置文件属性和时间]
查看>>
AutoCompleteTextView 和 TextWatcher 详解
查看>>
2.5. SciTE
查看>>
喵哈哈村的魔法考试 Round #1 (Div.2) 题解&源码(A.水+暴力,B.dp+栈)
查看>>
【转载】Java 内存分配全面浅析
查看>>
【Android】监听Notification被清除
查看>>
jQuery动态五星评分
查看>>
自制简单表单验证relative与absolute定位
查看>>
C标准函数库中获取时间与日期、对时间与日期数据操作及格式化
查看>>
WebGIS中解决使用Lucene进行兴趣点搜索排序的两种思路
查看>>
驱动继电器实验
查看>>
技术宅---我的网上抢火车票攻略
查看>>
爱上MVC~业务层刻意抛出异常,全局异常的捕获它并按格式返回
查看>>
R+Hadoop大数据方案有哪些坑?
查看>>