找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 12454|回复: 0

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

[复制链接]
发表于 2012-7-13 07:27:40 | 显示全部楼层 |阅读模式
悬赏100铜板未解决
</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(/[ms]/,2);
var dateLen=date.length;
var d=0;
var h=0;
m=dateLen==2?date[0]:"";
s=dateLen>0?date[dateLen-1]:"";
}
else if ((time.indexOf("d")<0)&&(time.indexOf("m")<0)){
var date = time.split(/[hs]/,2);
var dateLen=date.length;
var d=0;
var m=0;
h=dateLen==2?date[0]:"";
s=dateLen>0?date[dateLen-1]:"";
}
else if ((time.indexOf("h")<0)&&(time.indexOf("m")<0)){
var date = time.split(/[ds]/,2);
var dateLen=date.length;
var h=0;
var m=0;
d=dateLen==2?date[0]:"";
s=dateLen>0?date[dateLen-1]:"";
}
else if (time.indexOf("s")<0){
var date = time.split(/[dhm]/,3);
var dateLen=date.length;
var s=0;
d=dateLen==3?date[0]:"";
h=dateLen>1?date[dateLen-2]:"";
m=dateLen>0?date[dateLen-1]:"";
}
else if (time.indexOf("d")<0){
var date = time.split(/[hms]/,3);
var dateLen=date.length;
var d=0;
h=dateLen==3?date[0]:"";
m=dateLen>1?date[dateLen-2]:"";
s=dateLen>0?date[dateLen-1]:"";
}
else if (time.indexOf("h")<0){
var date = time.split(/[dms]/,3);
var dateLen=date.length;
var h=0;
d=dateLen==3?date[0]:"";
m=dateLen>1?date[dateLen-2]:"";
s=dateLen>0?date[dateLen-1]:"";
}
else if (time.indexOf("m")<0){
var date = time.split(/[dhs]/,3);
var dateLen=date.length;
var m=0;
d=dateLen==3?date[0]:"";
h=dateLen>1?date[dateLen-2]:"";
s=dateLen>0?date[dateLen-1]:"";
}
else {
var date = time.split(/[dhms]/,4);
var dateLen=date.length;
d=dateLen==4?date[0]:"";
h=dateLen>2?date[dateLen-3]:"";
m=dateLen>1?date[dateLen-2]:"";
s=dateLen>0?date[dateLen-1]:"";
}
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>


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

routeros
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-11-24 03:13 , Processed in 0.036969 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表