<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">test
<div id="num" class="num" style="display:none;" data-mce-style="display: none;">1000000</div><script type="mce-text/javascript"> String.prototype.repeat = function(n){ return Array(n + 1).join(this); }; var addFixed = 5, // 单次增加值 node = document.getElementById('num'), emTotal = node && node.innerHTML; function numAnim(){ var len = 1, last = 0, // 最终值 n = 0; // 需要填充的空白0 if(addFixed < emTotal){ // 跳出setTimeout条件 addFixed += Math.ceil((emTotal - addFixed) / 3); len = emTotal.length - (addFixed + '').length; last = n + '' + addFixed; n = '0'.repeat(10).slice(len); if(len == 0){ // 如果等于0后删除首位 last = last.slice(1); } last = last.split(''); last = '<strong>' + last.join('</strong><strong>') + '</strong>'; node.innerHTML = last; } setTimeout(numAnim, 100); } node.style.display = 'block'; numAnim(); </script>