唐山網站建設js控制倒計時輸入框觸發(fā)倒計時從頭開始!
代碼如下:
<SCRIPT type=text/javascript>
var timer=null;
function countDown(secs,surl,flag){
var jumpTo = document.getElementById('jumpTo');
jumpTo.innerHTML=secs;
if(flag=="b")
{
clearTimeout(timer);
if(--secs>0){
timer= setTimeout("countDown("+secs+",'"+surl+"')",1000);
}
else{
location.href=surl;
}
}
else{
if(--secs>0){
timer= setTimeout("countDown("+secs+",'"+surl+"')",1000);
} else{
location.href=surl;
}
}
}
</SCRIPT>
調用方法:
<script type="text/javascript">countDown180'index.asp','a');</script>
觸發(fā)從新進入倒計時
<script type="text/javascript">countDown180'index.asp','b');</script>