在prestashop系统里面的网站倒计时代码,使用以下代码:
</div>
{literal}//script必须写在这个标签里面
<SCRIPT type="text/javascript">
function GetRTime(){
var NowTime = new Date();
var EndTime= new Date('2014/04/30 24:00:00');
var StarTime = new Date('2014/04/26 00:00:00');
if (NowTime.getTime() < StarTime.getTime()) {
// alert("Sales promotion has yet to start!");
return false;
}else if(NowTime.getTime() > EndTime.getTime()){
// alert("Sales promotion activity has ended!");
return false;
}else{
var t =EndTime.getTime() - NowTime.getTime();
var d=Math.floor(t/1000/60/60/24);
var h=Math.floor(t/1000/60/60%24);
var m=Math.floor(t/1000/60%60);
var s=Math.floor(t/1000%60);
document.getElementById("t_d").innerHTML = d;
document.getElementById("t_h").innerHTML = h + ":";
document.getElementById("t_m").innerHTML = m + ":";
document.getElementById("t_s").innerHTML = s;
}
}
setInterval(GetRTime,1000);
function month(){//点击按钮,时间未到的时候跳转失败
var NowTime = new Date();
var EndTime= new Date('2014/04/30 24:00:00');
var StarTime = new Date('2014/04/26 00:00:00');
if (NowTime.getTime() < StarTime.getTime()) {
alert("Sales promotion has yet to start!");
}else if(NowTime.getTime() > EndTime.getTime()){
alert("Sales promotion activity has ended!");
}else{
window.location.href="http://www.starbridalapparel.com/monthlydeal.php";
}
}
</SCRIPT>
{/literal}
<div id="nav">
<ul>
<li>
<a href="{$link->getPageLink('index.php')}" id="red">Home</a></li>
{foreach from=$MENU_CMS item=items}
{foreach from=$items.cms item=item}
<li><a rel="nofollow" href="{$item.link}">{$item.meta_title}</a></li>
{/foreach}{/foreach}
<li class="nav_li"><a rel="nofollow" href="{$link->getPageLink('contact-form.php', true)}">Contact Us</a></li>
</ul>
</div>
<div id="columns">
<div class="nav">
<a href="#" onclick="month();">
<DIV id="CountMsg">
<span id="t_d">0</span>
<div id="date">
<span id="t_h">00:</span>
<span id="t_m">00:</span>
<span id="t_s">00</span>
</div>
</DIV>
</a>
</div>
{if !$sdsd}
<!-- Left -->
<div id="left_column" class="column">
{$HOOK_LEFT_COLUMN}
</div>
{/if}
<!-- Center -->
{if !$sdsd}//全局变量 $smarty->assign('sdsd', true);
<div id="center_column">
{/if}
{/if}
(责任编辑:最模板) |