<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title> snapping time countdown effect </title> <script language=" JavaScript "> function $ (Element) { return document.getElementById (Element); ()//limited-snapped var the_s=new Array (); function View_time (The_s_index,objid) {if (the_s[the_s_index]>=0) {var the_d=math.floor (the_s[the_s_index]/3600 )/24 var the_h=math.floor ((the_s[the_s_index]-the_d*24*3600)/3600); var The_m=math.floor ((the_s[the_s_index]-the_d*24*3600-the_h*3600)/60); var the_s= (the_s[the_s_index]-the_h*3600)%60; html = "still left"; if (the_d!=0) HTML + = the_d+ "Days"; if (the_d!=0 | | the_h!=0) HTML = ' <span class= ' hour ' > ' + (the_h+ (the_d*24)) + "</span> hour"; if (the_d!=0 | | the_h!=0 | | the_m!=0) HTML = ' <span class= ' minute ' > ' +the_m+ ' </span> minute "; html + + ' <span class= ' second ' > ' +the_s+ ' </span> sec; $ (objid). InnerHTML = html; the_s[the_s_index]--; }else{$ (objid). InnerHTML = "closed"; } </script> </pead> <body> <p class= "Time" id= "xsq_2402" > has <span class= "Hour" >14&l T;/span> hours <span class= "Minute" >49</span> min <span class= "Second" >44</span> sec </p> <script language= "JavaScript" > var startdate= new Date ("2010/07/16 09:07:43"); var enddate= new Date ("2010/07/17 00:00:00"); The_s[2402]= (Enddate.gettime ()-startdate.gettime ())/1000; SetInterval ("View_time (2402, ' xsq_2402 ')", 1000); </script> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]