var str = ""; var countlen =7; var sCountValue = "7066781"; var showmode=2; var counterstyle="16"; for(var i = 0;sCountValue.length<=countlen;i++) { sCountValue = "0" + sCountValue; } if(showmode == 1) { for(var i=0;i < sCountValue.length;i++) { str += ""; } } else { str =sCountValue; } document.write(sCountValue);