为什么10以下显示undefined?
<script>
window.onload = function(){
demo();
}
//函数
function demo(){
var endtime = new Date("2016,7,21,17:30:00"); //结束时间
var nowtime = new Date();
var time = parseInt((endtime.getTime() - nowtime.getTime())/1000);
var day = parseInt(time/60/60/24);
var hour = parseInt(time/60/60%24);
var min = parseInt(time/60%60);
var sec = parseInt(time%60);
document.getElementById('show').innerHTML = bb(day)+' 天'+bb(hour)+" 小时"+bb(min)+' 分钟'+bb(sec)+' 秒';
setTimeout(demo,100);
}
//+0
function bb(i){
if (i<10) {
i = 0+i;
}else{
return i;
}
}
</script>