
			<p>这是一则定时显示广告的javascript代码，当然也可以定时显示某一区块内容，很实用。</p>
<p><strong>代码如下：</strong></p>
<pre>function strToDate(str, ext) {
	if (str == null || str == '') return;
	var arys = new Array();
	arys = str.split('-');
	var newDate = new Date(arys[0], arys[1] - 1, arys[2], 9, 0, 0);
	if (ext) {
		newDate = new Date(newDate.getTime() + 1000 * 60 * 60 * 24);
	}
	return newDate;
}
function showit(str, start, end) {
	var date = new Date();
	var start = strToDate(start);
	var end = strToDate(end, false);
	if (date &amp; gt; start &amp; amp; &amp; amp; date document.write(str);
}
}</pre>
<p><strong>调取：</strong></p>
<pre>showit('Your ads','2011-07-06','2011-07-18');</pre>
<p>转载请注明：<a href="#">大前端</a> &raquo; <a href="#">js定时显示广告代码</a></p>		