求指点修改一段JS,点击“领取”后,重复显示倒计时时间并重新开始倒计时,十万分感谢!
<script language=javascript> <%
tm=now() '获取服务器当前时间
yeartm=year(tm)
monthtm=month(tm)
daytm=day(tm)
hourtm=hour(tm)
minutetm=minute(tm)
secondtm=second(tm)
%>var today = new Date(<%=yeartm%>,<%=monthtm%>,<%=daytm%>,<%=hourtm%>,<%=minutetm%>,<%=secondtm%>); gettime();function gettime()
{
today = new Date(Date.parse(today)+(1000*1));
var dayn=today.getDay();
var year=today.getYear();
var month = today.getMonth();
var date = today.getDate();
var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();
var timeValue = ((hours <10) ? "0" : "") +hours;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
var nowdate = year+"-"+month+"-"+date+" "+timeValue; tm1.innerText=nowdate; //显示当前时间if (nowdate < "<%=etm%>"){getDaydiff(nowdate,"<%=etm%>"); //执行比较
var sjc;
sjc = getDaydiff(nowdate,"<%=etm%>")
}
if (nowdate >= "<%=etm%>"){
diffDays2=("<a href='#' name='customers' onmousedown='showCustomer(this.d);jg.innerText=asdf' d="+<%=uid%>+"><font color=red>领取</font></a>"); //
jg.innerHTML = diffDays2;
}
window.setTimeout("gettime()", 1000);
}
function getDaydiff(d1, d2){ var arrDate,strDate,arrDate2,strDate2,diffDays
arrDate= d1.split("-")
strDate=new Date(arrDate[1] + '-' + arrDate[2] + '-' + arrDate[0])
arrDate2=d2.split("-")
strDate2= new Date(arrDate2[1] + '-' + arrDate2[2] + '-' + arrDate2[0]) h = Math.floor((strDate2-strDate)/1000/60/60);
n = Math.floor((strDate2-strDate)/1000/60%60);
s = Math.floor((strDate2-strDate)/1000%60);diffDays= ""+h+"时"+n+"分"+s+"秒";
jg.innerText=diffDays; //显示时间差值
}function $(item){
return document.getElementById(item);
}</script>
<script language=javascript> <%
tm=now() '获取服务器当前时间
yeartm=year(tm)
monthtm=month(tm)
daytm=day(tm)
hourtm=hour(tm)
minutetm=minute(tm)
secondtm=second(tm)
%>var today = new Date(<%=yeartm%>,<%=monthtm%>,<%=daytm%>,<%=hourtm%>,<%=minutetm%>,<%=secondtm%>); gettime();function gettime()
{
today = new Date(Date.parse(today)+(1000*1));
var dayn=today.getDay();
var year=today.getYear();
var month = today.getMonth();
var date = today.getDate();
var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();
var timeValue = ((hours <10) ? "0" : "") +hours;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
var nowdate = year+"-"+month+"-"+date+" "+timeValue; tm1.innerText=nowdate; //显示当前时间if (nowdate < "<%=etm%>"){getDaydiff(nowdate,"<%=etm%>"); //执行比较
var sjc;
sjc = getDaydiff(nowdate,"<%=etm%>")
}
if (nowdate >= "<%=etm%>"){
diffDays2=("<a href='#' name='customers' onmousedown='showCustomer(this.d);jg.innerText=asdf' d="+<%=uid%>+"><font color=red>领取</font></a>"); //
jg.innerHTML = diffDays2;
}
window.setTimeout("gettime()", 1000);
}
function getDaydiff(d1, d2){ var arrDate,strDate,arrDate2,strDate2,diffDays
arrDate= d1.split("-")
strDate=new Date(arrDate[1] + '-' + arrDate[2] + '-' + arrDate[0])
arrDate2=d2.split("-")
strDate2= new Date(arrDate2[1] + '-' + arrDate2[2] + '-' + arrDate2[0]) h = Math.floor((strDate2-strDate)/1000/60/60);
n = Math.floor((strDate2-strDate)/1000/60%60);
s = Math.floor((strDate2-strDate)/1000%60);diffDays= ""+h+"时"+n+"分"+s+"秒";
jg.innerText=diffDays; //显示时间差值
}function $(item){
return document.getElementById(item);
}</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货