我尝试从给定时间启动自定义计时器。但是change_time()无法正常工作。
<script>
var dd= ' 05: 41: 44 '; // i need to fix as per my need (start timer from 05: 41: 44 )
var res = dd.split(":");
function change_time()
{
var timestamp = new Date().setHours(res[0], res[1], res[2], 0);
var d = new Date(timestamp); // Midnight today 00:00:00.000
// alert(d);
var curr_hour = ("0" + d.getHours()).slice(-2);
var curr_min = ("0" + d.getMinutes()).slice(-2);
var curr_sec = ("0" + d.getSeconds()).slice(-2);
document.getElementById('Hour').innerHTML =curr_hour+':';
document.getElementById('Minut').innerHTML=curr_min+':';
document.getElementById('Second').innerHTML=curr_sec;
setInterval(change_time(),1000);
}
change_time();
</script>