首页 > 代码库 > 源生倒计时
源生倒计时
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>Document</title><style type="text/css">*{margin: 0;padding: 0;list-style:none;outline: none;border: 0;}div{width: 100px;height: 50px;line-height: 50px;text-align: center;background: orange;color: #fff;margin: 100px;cursor: pointer;}</style></head><body> <div id="rTime">点击发送</div><script type="text/javascript">if (typeof(rTime)==undefined&&!rTime) var rTime={};rTime={ _$ : function(d){ return document.getElementById(‘‘+d) || null; }, sTime : function(g){ if(typeof(g)==‘number‘&&g>0){ this.g = g; this.t = g; } }, bind : function(b,d,e,fn){ if(window.addEventListener){ if(b){ d.addEventListener(e,fn,false); }else{ d.removeEventListener(e,fn,false); } }else{ if(!b){ d.attachEvent(‘on‘+e,fn); }else{ d.detachEvent(‘on‘+e,fn); } } }, dTime : function(t){ var s = this, fn = function(){s.dTime(‘rTime‘);alert(1)}; if(t!==undefined) var d = s._$(t); if(s.g!==undefined){ if(s.g!==0){ s.bind(false,d,‘click‘,fn) d.innerHTML = s.g+‘秒发送‘; window.setTimeout(function(){ s.g--; s.innerHTML = s.g+‘秒发送‘; s.dTime(‘rTime‘); }, 200) }else{ s.g=s.t; d.innerHTML = ‘重新发送‘; s.bind(true,d,‘click‘,fn) } } }}rTime.sTime(1000);rTime.dTime(‘rTime‘);</script></body></html>
源生倒计时
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。