<div class="codetitle"> <span><a style="CURSOR: pointer" data="3342" class="copybut" id="copybut3342" onclick="doCopy('code3342')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code3342"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><제목></제목> <br><script src="http://img.jb51.net/jslib/jquery/jquery-1.7.1.min.js" type="text/javascript"></script> <br><script type="text/javascript"> <br>function showTime(tuanid, time_distance) { <br>this.tuanid = tuanid; <br>//PHP时间是秒,JS时间是微秒 <br>this.time_distance = time_distance * 1000; <br>} <br>showTime.prototype.setTimeShow = function () { <br>var 타이머 = $("#lefttime_" this.tuanid); <br>var str_time; <br>var int_day, int_hour, int_min, int_second; <br>시간_거리 = this.time_distance; <br>this.time_distance = this.time_distance - 1000; <br>if (time_distance > 0) { <br>int_day = Math.floor(time_distance / 86400000); <br>time_distance -= int_day * 86400000; <br>int_hour = Math.floor(time_distance / 3600000); <br>time_distance -= int_hour * 3600000; <br>int_분 = Math.floor(time_distance / 60000); <br>시간_거리 -= int_분 * 60000; <br>int_second = Math.floor(time_distance / 1000); <br>if (int_hour < 10) <br>int_hour = "0" int_hour; <br>if (int_분 < 10) <br>int_분 = "0" int_분; <br>if (int_second < 10) <br>int_second = "0" int_second; <br>str_time = int_day "천" int_hour "소시" int_분 "분별" int_second "秒"; <br>timer.text(str_time); <br>var self = this; <br>setTimeout(function () { self.setTimeShow(); }, 1000); //D:수정 <br>} else { <br>timer.text("团购结束"); <br>반환; <br>} <br>} <br></script> <br></head> <br><본문> <br><div id="lefttime_1" time="2011/11/23 6:58:23"> <br><br></div> <br><script type="text/javascript"> <br>var st = new showTime(1,3); <br>//st.tuanid = 1; <br>//st.time_distance = 10000; <br>st.setTimeShow(); <br></script> <br><div id="lefttime_2" time="2011/11/24 6:58:23"> <br><br></div> <br><script type="text/javascript"> <br>var st = new showTime(2, 5); <br>//st.tuanid = 1; <br>//st.time_distance = 10000; <br>st.setTimeShow(); <br></script> <br></body> <br></html> <br> </div> <br>상위면의 代码需要用到jquery, 大家可以注意下