// 剩余时间提醒 function checkTime() { if (timeCompare()) { document.getElementById('distanceDeadline').innerHTML = "距离截止时间:已超时"; } else { var now = new Date(); var nowTime = now.getTime(); var year = now.getFullYear(); var month = now.getMonth() + 1;//js从0开始取 var date = now.getDate(); var deadlineStr = year + "/" + month + "/" + date + " " + "16:30:00"; var deadline = Date.parse(deadlineStr); var timeDisparity = (deadline - nowTime)/60000; document.getElementById('distanceDeadline').innerHTML = "距离截止时间:" + (Math.ceil(timeDisparity)) + "分钟"; } }