日期:2014-05-16 浏览次数:20551 次
//计算竟拍剩余时间 function chickEndtime(){ var endtime = document.getElementById("endtime").innerText;//获取结束时间 //获得当前时间 var d = new Date(); var s = d.getYear()+ "-" + (d.getMonth() + 1) + "-" + d.getDate() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds(); var d1 = new Date(endtime.replace(/-/g, "/")); var d2 = new Date(s.replace(/-/g, "/")); if (Date.parse(d1) - Date.parse(d2) > 0) { //计算当前时间距结束时间多少秒 var miao = (Date.parse(d1) - Date.parse(d2))/1000; //计算相差多少天 var tian = parseInt(miao/86400);//获得天数 var shi = parseInt(miao/3600-tian*24);//获得小时数 var fen = parseInt(miao/60-(shi*60+tian*1440));//获得分钟数 var timeed = tian+"天"+shi+"时"+fen+"分"; document.getElementById("timeed").innerText = timeed; }else if (Date.parse(d1) - Date.parse(d2) <= 0) { alert("该商品竟拍已结束!"); window.location = "http://localhost:8080/NTWshop_JP/servlet/ServletUpdateApStatus?id=<%=request.getParameter("id") %>"; } }