当前位置:首页 > 程序&理念 >

JavaScript时区显示

时间:2008-11-26 12:04:03浏览:15970 本站原创

北京时间  <SPAN id=beijing></SPAN>
伦敦时间  <SPAN id=london></SPAN>
纽约时间  <SPAN id=newyork></SPAN>
芝加哥时间<SPAN id=chicago></SPAN>
东京时间  <SPAN id=tokyo></SPAN>
<SCRIPT language=javascript type=text/javascript>
function time_rota()
{
var now;
var h,m,s;
now = new Date();
h=now.getHours();
m=now.getMinutes();
s=now.getSeconds();
h=((h < 10) ? \"0\" : \"\") + h;
m=((m < 10) ? \"0\" : \"\") + m;
s=((s < 10) ? \"0\" : \"\") + s;
document.all.beijing.innerHTML = h+\":\"+m+\":\"+s;
setTimeout(\"time_rota()\", 1000);
}
time_rota();
function time_rota1()
{
var now;
var h,m,s;
now = new Date();
h=now.getUTCHours();
h -= -0;
if(h<0)
{h += 24;}
m=now.getUTCMinutes();
s=now.getUTCSeconds();
h=((h < 10) ? \"0\" : \"\") + h;
m=((m < 10) ? \"0\" : \"\") + m;
s=((s < 10) ? \"0\" : \"\") + s;
document.all.london.innerHTML = h+\":\"+m+\":\"+s;
setTimeout(\"time_rota1()\", 1000);
}
time_rota1();
function time_rota2()
{
var now;
var h,m,s;
now = new Date();
h=now.getHours();
h -= 13;
if(h<0)
{h += 24;}
m=now.getMinutes();
s=now.getSeconds();
h=((h < 10) ? \"0\" : \"\") + h;
m=((m < 10) ? \"0\" : \"\") + m;
s=((s < 10) ? \"0\" : \"\") + s;
document.all.newyork.innerHTML = h+\":\"+m+\":\"+s;
setTimeout(\"time_rota2()\", 1000);
}
time_rota2();
function time_rota3()
{
var now;
var h,m,s;
now = new Date();
h=now.getUTCHours();
h -= -9;
if(h<=0)
{h += 24;}
m=now.getUTCMinutes();
s=now.getUTCSeconds();
h=((h < 10) ? \"0\" : \"\") + h;
m=((m < 10) ? \"0\" : \"\") + m;
s=((s < 10) ? \"0\" : \"\") + s;
document.all.tokyo.innerHTML = h+\":\"+m+\":\"+s;
setTimeout(\"time_rota3()\", 1000);
}
time_rota3();
function time_rota4()
{
var now;
var h,m,s;
now = new Date();
h=now.getUTCHours();
h -= 6;
if(h<=0)
{h += 24;}
m=now.getUTCMinutes();
s=now.getUTCSeconds();
h=((h < 10) ? \"0\" : \"\") + h;
m=((m < 10) ? \"0\" : \"\") + m;
s=((s < 10) ? \"0\" : \"\") + s;
document.all.chicago.innerHTML = h+\":\"+m+\":\"+s;
setTimeout(\"time_rota4()\", 1000);
}
time_rota4();
</SCRIPT>
1

上一篇:退弹代码
下一篇:历史的记录,终于在自己家可以装宽带了

发表评论

昵称:  验证码:

关于博主

博主

博主:BlueCode

职业:web程序

简介:2002年开始一直从事Web制作,网站运营,会PHP+MYSQL ASP+MSSQL,微信开发