时间倒计时
var stophtml="2014-10-1";
var startTime="2015-10-1";
var stophtml= $("#stopTime #time").html(); var startTime =starthtml.split("-"); var stopTime =stophtml.split("-"); var start0 = startTime[0], start1 = startTime[1], start2 = startTime[2]; var stop0 = stopTime[0], stop1 = stopTime[1], stop2 = parseInt(stopTime[2]) + 1; var day1 = new Date(start0, start1 - 1, start2).getTime(); var day2 = new Date(stop0, stop1 - 1, stop2).getTime(); var today = new Date(); var ms, dt; ms = day2 - today; dt = Math.ceil(ms / 1000 / 3600 / 24); alert(stopTime) if (ms > 0) { $("#last").html("(剩余约" + dt + "天)"); } else if (ms == 0) { $("#last").html("(剩余约" + 1 + "天)"); } else { $("#last").html("(已过期)"); }