Loading... <ol class="linenums" style="margin:0px 0px 0px 40px;padding:0px;border:0px;line-height:1;font-family:Monaco, 'Andale Mono', 'Courier New', monospace;color:#404040;white-space:pre-wrap;"> <li class="L0" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="tag" style="color:#195F91;"><SPAN</span><span class="pln" style="color:#93A1A1;"> </span><span class="atn" style="color:#CB4B16;">id</span><span class="pun" style="color:#93A1A1;">=</span><span class="atv" style="color:#268BD2;">"span_dt_dt"</span><span class="tag" style="color:#195F91;">></SPAN></span> </li> <li class="L1" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="tag" style="color:#195F91;"><SCRIPT</span><span class="pln" style="color:#93A1A1;"> </span><span class="atn" style="color:#CB4B16;">language</span><span class="pun" style="color:#93A1A1;">=</span><span class="atv" style="color:#268BD2;">javascript</span><span class="tag" style="color:#195F91;">></span> </li> <li class="L2" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="kwd" style="color:#195F91;">function</span><span class="pln" style="color:#93A1A1;"> show_date_time</span><span class="pun" style="color:#93A1A1;">(){</span> </li> <li class="L3" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">window</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">setTimeout</span><span class="pun" style="color:#93A1A1;">(</span><span class="str" style="color:#268BD2;">"show_date_time()"</span><span class="pun" style="color:#93A1A1;">,</span><span class="pln" style="color:#93A1A1;"> </span><span class="lit" style="color:#195F91;">1000</span><span class="pun" style="color:#93A1A1;">);</span> </li> <li class="L4" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="typ" style="color:#CB4B16;">BirthDay</span><span class="pun" style="color:#93A1A1;">=</span><span class="kwd" style="color:#195F91;">new</span><span class="pln" style="color:#93A1A1;"> </span><span class="typ" style="color:#CB4B16;">Date</span><span class="pun" style="color:#93A1A1;">(</span><span class="str" style="color:#268BD2;">"8/3/2014 19:10:08"</span><span class="pun" style="color:#93A1A1;">);</span><span class="com" style="color:#93A1A1;">//月,日,年,小时,分钟,秒</span> </li> <li class="L5" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">today</span><span class="pun" style="color:#93A1A1;">=</span><span class="kwd" style="color:#195F91;">new</span><span class="pln" style="color:#93A1A1;"> </span><span class="typ" style="color:#CB4B16;">Date</span><span class="pun" style="color:#93A1A1;">();</span> </li> <li class="L6" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">timeold</span><span class="pun" style="color:#93A1A1;">=(</span><span class="pln" style="color:#93A1A1;">today</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">getTime</span><span class="pun" style="color:#93A1A1;">()-</span><span class="typ" style="color:#CB4B16;">BirthDay</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">getTime</span><span class="pun" style="color:#93A1A1;">());</span> </li> <li class="L7" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">sectimeold</span><span class="pun" style="color:#93A1A1;">=</span><span class="pln" style="color:#93A1A1;">timeold</span><span class="pun" style="color:#93A1A1;">/</span><span class="lit" style="color:#195F91;">1000</span> </li> <li class="L8" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">secondsold</span><span class="pun" style="color:#93A1A1;">=</span><span class="typ" style="color:#CB4B16;">Math</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">floor</span><span class="pun" style="color:#93A1A1;">(</span><span class="pln" style="color:#93A1A1;">sectimeold</span><span class="pun" style="color:#93A1A1;">);</span> </li> <li class="L9" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">msPerDay</span><span class="pun" style="color:#93A1A1;">=</span><span class="lit" style="color:#195F91;">24</span><span class="pun" style="color:#93A1A1;">*</span><span class="lit" style="color:#195F91;">60</span><span class="pun" style="color:#93A1A1;">*</span><span class="lit" style="color:#195F91;">60</span><span class="pun" style="color:#93A1A1;">*</span><span class="lit" style="color:#195F91;">1000</span> </li> <li class="L0" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">e_daysold</span><span class="pun" style="color:#93A1A1;">=</span><span class="pln" style="color:#93A1A1;">timeold</span><span class="pun" style="color:#93A1A1;">/</span><span class="pln" style="color:#93A1A1;">msPerDay</span> </li> <li class="L1" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">daysold</span><span class="pun" style="color:#93A1A1;">=</span><span class="typ" style="color:#CB4B16;">Math</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">floor</span><span class="pun" style="color:#93A1A1;">(</span><span class="pln" style="color:#93A1A1;">e_daysold</span><span class="pun" style="color:#93A1A1;">);</span> </li> <li class="L2" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">e_hrsold</span><span class="pun" style="color:#93A1A1;">=(</span><span class="pln" style="color:#93A1A1;">e_daysold</span><span class="pun" style="color:#93A1A1;">-</span><span class="pln" style="color:#93A1A1;">daysold</span><span class="pun" style="color:#93A1A1;">)*</span><span class="lit" style="color:#195F91;">24</span><span class="pun" style="color:#93A1A1;">;</span> </li> <li class="L3" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">hrsold</span><span class="pun" style="color:#93A1A1;">=</span><span class="pln" style="color:#93A1A1;">setzero</span><span class="pun" style="color:#93A1A1;">(</span><span class="typ" style="color:#CB4B16;">Math</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">floor</span><span class="pun" style="color:#93A1A1;">(</span><span class="pln" style="color:#93A1A1;">e_hrsold</span><span class="pun" style="color:#93A1A1;">));</span> </li> <li class="L4" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">e_minsold</span><span class="pun" style="color:#93A1A1;">=(</span><span class="pln" style="color:#93A1A1;">e_hrsold</span><span class="pun" style="color:#93A1A1;">-</span><span class="pln" style="color:#93A1A1;">hrsold</span><span class="pun" style="color:#93A1A1;">)*</span><span class="lit" style="color:#195F91;">60</span><span class="pun" style="color:#93A1A1;">;</span> </li> <li class="L5" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">minsold</span><span class="pun" style="color:#93A1A1;">=</span><span class="pln" style="color:#93A1A1;">setzero</span><span class="pun" style="color:#93A1A1;">(</span><span class="typ" style="color:#CB4B16;">Math</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">floor</span><span class="pun" style="color:#93A1A1;">((</span><span class="pln" style="color:#93A1A1;">e_hrsold</span><span class="pun" style="color:#93A1A1;">-</span><span class="pln" style="color:#93A1A1;">hrsold</span><span class="pun" style="color:#93A1A1;">)*</span><span class="lit" style="color:#195F91;">60</span><span class="pun" style="color:#93A1A1;">));</span> </li> <li class="L6" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">seconds</span><span class="pun" style="color:#93A1A1;">=</span><span class="pln" style="color:#93A1A1;">setzero</span><span class="pun" style="color:#93A1A1;">(</span><span class="typ" style="color:#CB4B16;">Math</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">floor</span><span class="pun" style="color:#93A1A1;">((</span><span class="pln" style="color:#93A1A1;">e_minsold</span><span class="pun" style="color:#93A1A1;">-</span><span class="pln" style="color:#93A1A1;">minsold</span><span class="pun" style="color:#93A1A1;">)*</span><span class="lit" style="color:#195F91;">60</span><span class="pun" style="color:#93A1A1;">));</span> </li> <li class="L7" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">span_dt_dt</span><span class="pun" style="color:#93A1A1;">.</span><span class="pln" style="color:#93A1A1;">innerHTML</span><span class="pun" style="color:#93A1A1;">=</span><span class="str" style="color:#268BD2;">"已运行"</span><span class="pun" style="color:#93A1A1;">+</span><span class="pln" style="color:#93A1A1;">daysold</span><span class="pun" style="color:#93A1A1;">+</span><span class="str" style="color:#268BD2;">"天"</span><span class="pun" style="color:#93A1A1;">+</span><span class="pln" style="color:#93A1A1;">hrsold</span><span class="pun" style="color:#93A1A1;">+</span><span class="str" style="color:#268BD2;">"小时"</span><span class="pun" style="color:#93A1A1;">+</span><span class="pln" style="color:#93A1A1;">minsold</span><span class="pun" style="color:#93A1A1;">+</span><span class="str" style="color:#268BD2;">"分"</span><span class="pun" style="color:#93A1A1;">+</span><span class="pln" style="color:#93A1A1;">seconds</span><span class="pun" style="color:#93A1A1;">+</span><span class="str" style="color:#268BD2;">"秒"</span><span class="pun" style="color:#93A1A1;">;</span> </li> <li class="L8" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pun" style="color:#93A1A1;">}</span> </li> <li class="L9" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="kwd" style="color:#195F91;">function</span><span class="pln" style="color:#93A1A1;"> setzero</span><span class="pun" style="color:#93A1A1;">(</span><span class="pln" style="color:#93A1A1;">i</span><span class="pun" style="color:#93A1A1;">){</span> </li> <li class="L0" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="kwd" style="color:#195F91;">if</span><span class="pln" style="color:#93A1A1;"> </span><span class="pun" style="color:#93A1A1;">(</span><span class="pln" style="color:#93A1A1;">i</span><span class="pun" style="color:#93A1A1;"><</span><span class="lit" style="color:#195F91;">10</span><span class="pun" style="color:#93A1A1;">)</span> </li> <li class="L1" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pun" style="color:#93A1A1;">{</span><span class="pln" style="color:#93A1A1;">i</span><span class="pun" style="color:#93A1A1;">=</span><span class="str" style="color:#268BD2;">"0"</span><span class="pln" style="color:#93A1A1;"> </span><span class="pun" style="color:#93A1A1;">+</span><span class="pln" style="color:#93A1A1;"> i</span><span class="pun" style="color:#93A1A1;">};</span> </li> <li class="L2" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="kwd" style="color:#195F91;">return</span><span class="pln" style="color:#93A1A1;"> i</span><span class="pun" style="color:#93A1A1;">;</span> </li> <li class="L3" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pun" style="color:#93A1A1;">}</span> </li> <li class="L4" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="pln" style="color:#93A1A1;">show_date_time</span><span class="pun" style="color:#93A1A1;">();</span> </li> <li class="L5" style="margin:0px;padding:0px 5px;border:0px;line-height:20px;font-family:inherit;color:rgba(0, 0, 0, 0.14902);border-radius:2px;"> <span class="tag" style="color:#195F91;"></SCRIPT></span> </li> </ol> <SPAN id="span_dt_dt"></SPAN> <SCRIPT language=javascript> function show_date_time(){ window.setTimeout("show_date_time()", 1000); BirthDay=new Date("8/3/2014 19:10:08");//月,日,年,小时,分钟,秒 today=new Date(); timeold=(today.getTime()-BirthDay.getTime()); sectimeold=timeold/1000 secondsold=Math.floor(sectimeold); msPerDay=24*60*60*1000 e_daysold=timeold/msPerDay daysold=Math.floor(e_daysold); e_hrsold=(e_daysold-daysold)*24; hrsold=setzero(Math.floor(e_hrsold)); e_minsold=(e_hrsold-hrsold)*60; minsold=setzero(Math.floor((e_hrsold-hrsold)*60)); seconds=setzero(Math.floor((e_minsold-minsold)*60)); span_dt_dt.innerHTML="已运行"+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒"; } function setzero(i){ if (i<10) {i="0" + i}; return i; } show_date_time(); </SCRIPT> 最后修改:1970 年 01 月 01 日 © 允许规范转载 打赏 赞赏作者 赞 如果觉得我的文章对你有用,请随意赞赏