标签:numa nbsp int OLE innerhtml get change interval 数字
一个页面打开数字数据自动想加的特效(一般用于网站浏览数据,客户数量的动态展示);
<span>00</span>
<div>00</div>
<script>
function changeNum(dom,endNum){
this.startNum=0;
this.endNum=endNum;
this.dom=document.getElementsByTagName(dom)[0];
this.NumAdd();
};
changeNum.prototype.NumAdd=function(){
var _this=this;
this.timer=setInterval(function(){
_this.startNum++;
if(_this.startNum<10){
_this.startNum=‘0‘+_this.startNum;
}
if(_this.startNum==_this.endNum){
clearInterval(_this.timer);
}
console.log(_this.startNum);
_this.dom.innerHTML=_this.startNum;
},100)
};
标签:numa nbsp int OLE innerhtml get change interval 数字
原文地址:https://www.cnblogs.com/lwj820876312/p/10262712.html