最新状态栏世界时间_JS特效代码

以下是三零网为大家整理的最新状态栏世界时间_JS特效代码的文章,希望大家能够喜欢!


第一步:把如下代码加入<body>区域中
 <script language=javaScript>
<!-- Beginning of JavaScript -
var worldtime = new Array()
worldtime[0]="亚述尔群岛,-2"
worldtime[1]="巴格达,3"
worldtime[2]="北京,8"
worldtime[3]="柏林,2"
worldtime[4]="亚尔河,-3"
worldtime[5]="芝加哥,-6"
worldtime[6]="丹佛,-7"
worldtime[7]="香港,8"
worldtime[8]="檀香山,-10"
worldtime[9]="约翰内斯堡,2"
worldtime[10]="开罗,2"
worldtime[11]="利马,-5"
worldtime[12]="伦敦,0"
worldtime[13]="墨西哥城,-6"
worldtime[14]="莫斯科,3"
worldtime[15]="纽约,-5"
worldtime[16]="巴黎,1"
worldtime[17]="Perth,8"
worldtime[18]="Rio de Janheiro,-3"
worldtime[19]="旧金山,-8"
worldtime[20]="悉尼,11"
worldtime[21]="东京,9"

// The speed of the ticker (milliseconds)
var speed=1000

// The length of the steps
var step=10

// Do not edit the variables below
var hours
var shifthours
var minutes
var seconds
var localhours
var thisplace
var i_substring=0

var content

function extracttime() {
content=" -------------------------------------"
for (i=0;i<=worldtime.length-1;i++) {
 thisplace=worldtime[i].split(",")
 thistime= new Date()
 hours=thistime.getUTCHours()
 hours=eval(hours)
 shifthours=eval(thisplace[1])
 localhours=eval(shifthours+hours)
 if (localhours <0) {localhours=24+localhours}
 if (localhours >=24) {localhours=localhours-24}
 
 minutes=thistime.getUTCMinutes()
 seconds=thistime.getUTCSeconds()
 
 if (thisplace[0]=='Delhi') {
  minutes=eval(minutes+30)
  if (minutes>=60) {
   minutes=eval(minutes-60)
   localhours=eval(localhours+1)
  }
 }
 if (eval(minutes) < 10) {minutes="0"+minutes}
 if (eval(seconds) < 10) {seconds="0"+seconds}
 if (eval(localhours) < 10) {localhours="0"+localhours}
 thistime = localhours+":"+minutes
 content+=" ------ "+thisplace[0]+": "+thistime
 }
 content+=" -------------------------------------"
 scrolltime()
}

function scrolltime() {
 if (i_substring<=content.length-1) {
  window.status=content.substring(i_substring,content.length-1)
  i_substring=i_substring+step
  var timer=setTimeout("extracttime()",speed)
 }
 else {
  i_substring=0
  clearTimeout(timer)
  extracttime()
 }
}

// - End of JavaScript - -->
</script>

 

 
第二步:修改<body***>中的内容,将下面的代码加入原<body***>中
onLoad="extracttime()"


转载来自:http://www.q3060.com/list3/list115/326.html