<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>时间格式倒计时 &#8211; LPC影子技术分享</title>
	<atom:link href="https://www.mudbest.com/tag/%E6%97%B6%E9%97%B4%E6%A0%BC%E5%BC%8F%E5%80%92%E8%AE%A1%E6%97%B6/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.mudbest.com</link>
	<description>行影不离,忘之却步.</description>
	<lastBuildDate>Mon, 01 Oct 2012 08:24:54 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>js简单实现时间格式倒计时</title>
		<link>https://www.mudbest.com/js%e7%ae%80%e5%8d%95%e5%ae%9e%e7%8e%b0%e6%97%b6%e9%97%b4%e6%a0%bc%e5%bc%8f%e5%80%92%e8%ae%a1%e6%97%b6/</link>
		
		<dc:creator><![CDATA[hkshadow]]></dc:creator>
		<pubDate>Tue, 13 Mar 2012 03:48:23 +0000</pubDate>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[倒计时]]></category>
		<category><![CDATA[时间格式倒计时]]></category>
		<guid isPermaLink="false">http://www.mudbest.com/?p=913</guid>

					<description><![CDATA[在网上找了很多相关的例子，总觉得还是要根据需求来写不一样的代码，就如我只是想要实现一个时间格式的倒计时，就不需...]]></description>
										<content:encoded><![CDATA[<p>在网上找了很多相关的例子，总觉得还是要根据需求来写不一样的代码，就如我只是想要实现一个时间格式的倒计时，就不需要什么插件了，简短的一段代码即可实现。</p>
<p>看代码了：<br />
<span id="more-913"></span></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
&lt;!--
var maxtime = 7200;//按秒计算，自己调整! by hkshadow QQ 2765237
function CountDown(){
 if(maxtime &gt;= 0){
 seconds = maxtime--;
 	//var d = parseInt(seconds/86400);
 	var h = parseInt((seconds%86400)/3600);
	var m = parseInt((seconds%3600)/60);
	var s = parseInt(seconds%60);
	
	var h = h &gt; 0 ? h : &quot;00&quot;;
	var m = m &gt; 0 ? m : &quot;00&quot;;
	var s = s &gt; 0 ? s : &quot;00&quot;;
	
 	//msg = d+&quot;天&quot;+h+&quot;小时&quot;+m+&quot;分钟&quot;+s+&quot;秒&quot;;  //倒计时
  	//msg = &quot;&quot;+h+&quot;：&quot;+m+&quot;：&quot;+s+&quot;：&quot;;  //倒计时
	//var date_array = &#x5B;h,m,s];
 	document.getElementById('hour').innerHTML=h;
 	document.getElementById('minute').innerHTML=m;
  	document.getElementById('second').innerHTML=s;
}
 else{
		clearInterval(second);
		//P.cancel();
	// top.location = &quot;/index.php&quot;;
	 }
}
setInterval(&quot;CountDown()&quot;,1000);
//--&gt;
&lt;/script&gt;
</pre>
<p>html页面代码：</p>
<pre class="brush: xml; title: ; notranslate">
&lt;span class=&quot;thespan1&quot; id=&quot;hour&quot;&gt;..&lt;/span&gt;
&lt;span class=&quot;thespan2&quot;&gt;：&lt;/span&gt;
&lt;span class=&quot;thespan1&quot; id=&quot;minute&quot;&gt;..&lt;/span&gt;
&lt;span class=&quot;thespan2&quot;&gt;：&lt;/span&gt;
&lt;span class=&quot;thespan1&quot; id=&quot;second&quot;&gt;..&lt;/span&gt;
</pre>
<p>最后的效果是<br />
1：24：50</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
