netww 发表于 2012-7-13 07:27:40

求帮助``改时间显示为动态谁帮帮忙

</script><input name="hiddenField" type="hidden" id="hiddenField" value="$(session-time-left)" /></b></DIV>
<DIV style="HEIGHT: 60px; width:297px"><b>剩余时间:<script language="JavaScript">
function axiang(){
var time = document.getElementById("hiddenField").value;
var d,h,m,s;
if ((time.indexOf("d")<0)&&(time.indexOf("h")<0)){
var date = time.split(//,2);
var dateLen=date.length;
var d=0;
var h=0;
m=dateLen==2?date:"";
s=dateLen>0?date:"";
}
else if ((time.indexOf("d")<0)&&(time.indexOf("m")<0)){
var date = time.split(//,2);
var dateLen=date.length;
var d=0;
var m=0;
h=dateLen==2?date:"";
s=dateLen>0?date:"";
}
else if ((time.indexOf("h")<0)&&(time.indexOf("m")<0)){
var date = time.split(//,2);
var dateLen=date.length;
var h=0;
var m=0;
d=dateLen==2?date:"";
s=dateLen>0?date:"";
}
else if (time.indexOf("s")<0){
var date = time.split(//,3);
var dateLen=date.length;
var s=0;
d=dateLen==3?date:"";
h=dateLen>1?date:"";
m=dateLen>0?date:"";
}
else if (time.indexOf("d")<0){
var date = time.split(//,3);
var dateLen=date.length;
var d=0;
h=dateLen==3?date:"";
m=dateLen>1?date:"";
s=dateLen>0?date:"";
}
else if (time.indexOf("h")<0){
var date = time.split(//,3);
var dateLen=date.length;
var h=0;
d=dateLen==3?date:"";
m=dateLen>1?date:"";
s=dateLen>0?date:"";
}
else if (time.indexOf("m")<0){
var date = time.split(//,3);
var dateLen=date.length;
var m=0;
d=dateLen==3?date:"";
h=dateLen>1?date:"";
s=dateLen>0?date:"";
}
else {
var date = time.split(//,4);
var dateLen=date.length;
d=dateLen==4?date:"";
h=dateLen>2?date:"";
m=dateLen>1?date:"";
s=dateLen>0?date:"";
}
var ROSd = eval(d) + 0;
var ROSh = eval(h) + 0;
var ROSm = eval(m) + 0;
var ROSs = eval(s) + 0;
var timearrN = ROSd+"天"+ROSh+"时"+ROSm+"分"+ROSs+"秒";
var timearr = timearrN.replace(/NaN/g,"0");

Today = new Date();//定义当天日期对象
var NowYear = Today.getFullYear();//获取年份
var NowMonth = Today.getMonth();//获取月份
var NowDate = Today.getDate();//获取日期值
var NowHour = Today.getHours();//获取时
var NowMinute = Today.getMinutes();//获取分
var NowSecond = Today.getSeconds();//获取秒
//var datenow = NowYear+"年"+NowMonth+"月"+NowDate+"日"+NowHour+"时"+NowMinute+"分"+NowSecond+"秒";

var nextDay = new Date(NowYear,NowMonth,NowDate,NowHour,NowMinute,NowSecond+(d*24*3600+h*3600+m*60+eval(s)));
var EndYear = nextDay.getFullYear();//获取年份
var EndMonth = nextDay.getMonth()+1;//获取月份
var EndDay = nextDay.getDate();//获取日期值
var EndHour = nextDay.getHours();//获取时
var EndMinute = nextDay.getMinutes();//获取分
var EndSecond = nextDay.getSeconds();//获取秒
var dateend = EndYear+"年"+EndMonth+"月"+EndDay+"号"+EndHour+"时"+EndMinute+"分"+EndSecond+"秒";

var HourtoEnd = d*24+eval(h)+0;
if (72<=HourtoEnd){
//    NOTET1.innerHTML = "尊敬的用户,欢迎使用无线宽带认证系统,如在使用过程中遇到问题,可与管理员联系!"
    document.write (timearr);
      document.write("<br/>")
      document.write ("<br/>有效日期:"+dateend);
    }
else if (12<=HourtoEnd && HourtoEnd<72){
//      NOTET2.innerHTML = "尊敬的用户,你的账号将于" + HourtoEnd + "小时后到期!请注意及时充值,以免账号被停用无法上网,从而带来不必要的影响!"
          document.write (timearr);
      document.write("<br/>")
      document.write ("<br/>有效日期:"+dateend);
      }
else if(1<=HourtoEnd && HourtoEnd<13){
//    NOTET3.innerHTML = ""
      document.write (timearr);
      document.write("<br/>")
      document.write ("<br/>有效日期:"+dateend);
    }
else if(HourtoEnd.value="转换"){
//    NOTET3.innerHTML = "尊敬的用户,你的账号将于"+(eval(h)+0)+"分钟内到期!如正在使用联网软件,请注意及时备份和离线!"
      document.write (timearr);
      document.write("<br/>");
      document.write ("<br/>有效日期:<font style='color:#FF0000; font-size:14px'>将于"+(eval(m)+0)+"分钟内到期,请<a href ='taocan.html'>充值</a>.</font>");
      }
}
</script><script type="text/javascript">axiang();</script>


求帮助``改时间显示为动态谁帮帮忙
页: [1]
查看完整版本: 求帮助``改时间显示为动态谁帮帮忙