方法一
var timmer = setInterval(function () {
var curDate = new Date();
var str = curDate.toTimeString();
var t= str.substring(0,8);
if (time == '14:53:40') {
console.log('after '+time);
clearInterval(timmer);
window.location.href ='index';
}
}, 1000)
方法二
var date = new Date();
var now = date.getTime();
date.setHours(0);
date.setMinutes(0);
date.setSeconds(0);
var t2 = new Date(date.getTime() + 1000 * 60 * 60 * 24);
var time =t2-now;
// console.log(time)
setTimeout(function(){
window.location.href ='index';
},time)