日期:2014-05-16 浏览次数:20327 次
var s=parseInt(data); var format,array; var hours = Math.floor(s/(60*60)); var minutes = Math.floor(s/60)-Math.floor(s/3600)*60; var second = Math.floor(s)-Math.floor(s/60)*60; if(hours>0){ // minutes=minutes-hours*60; // second=second-minutes*60-hours*60*60; format="${0}时${1}分${2}秒"; array=[hours,minutes,second]; }else if(minutes>0){ format="${0}分${1}秒"; array=[minutes,second]; }else{ format="${0}秒"; array=[second]; } html= dojo.string.substitute(format,array);本例用了dojo的API。