状态栏文字从右弹出<script language="JavaScript"> <!-- function statusMessageObject(p,d) { this.msg = MESSAGE this.out = " " this.pos = POSITION this.delay = DELAY this.i = 0 this.reset = clearMessage } function clearMessage() { this.pos = POSITION } var POSITION = 100 <!-- 改变下面的数字变换文字弹出速度,数字越大速度越慢--> var DELAY = 3; <!-- 改变下面的文字变换状态栏文字--> var MESSAGE = "欢迎光临辰桦网络 " var scroll = new statusMessageObject() function scroller() { for (scroll.i = 0; scroll.i < scroll.pos; scroll.i++) { scroll.out += " " } if (scroll.pos >= 0) scroll.out += scroll.msg else scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length) window.status = scroll.out scroll.out = " " scroll.pos-- if (scroll.pos < -(scroll.msg.length)) { scroll.reset() } setTimeout ('scroller()',scroll.delay) } function snapIn(jumpSpaces,position) { var msg = scroll.msg var out = "" for (var i=0; i<position; i++) {out += msg.charAt(i)} for (i=1;i<jumpSpaces;i++) {out += " "} out += msg.charAt(position) window.status = out if (jumpSpaces <= 1) { position++ if (msg.charAt(position) == ' ') {position++ } jumpSpaces = 100-position } else if (jumpSpaces > 3) {jumpSpaces *= .75} else {jumpSpaces--} if (position != msg.length) { var cmd = "snapIn(" + jumpSpaces + "," + position + ")"; scrollID = window.setTimeout(cmd,scroll.delay); } else { window.status="" jumpSpaces=0 position=0 cmd = "snapIn(" + jumpSpaces + "," + position + ")"; scrollID = window.setTimeout(cmd,scroll.delay); return false } return true } snapIn(100,0); // --> </script>
状态栏文字从右到左移动<script> <!-- Beginning of JavaScript Applet ------------------- function scrollit_r2l(seed) <!-- 改变下面的文字变换状态栏显示的文字--> { var m1 = "欢迎光临辰桦网络" ; var m2 = "" ; var msg=m1+m2; var out = " "; var c = 1; <!-- 改变下面的数字改变移动速度,数字越大速度越慢--> var speed = 100; if (seed > 100) { seed-=2; var cmd="scrollit_r2l(" + seed + ")"; timerTwo=window.setTimeout(cmd,speed);} else if (seed <= 100 && seed > 0) { for (c=0 ; c < seed ; c++) { out+=" ";} out+=msg; seed-=2; var cmd="scrollit_r2l(" + seed + ")"; window.status=out; timerTwo=window.setTimeout(cmd,speed); } else if (seed <= 0) { if (-seed < msg.length) { out+=msg.substring(-seed,msg.length); seed-=2; var cmd="scrollit_r2l(" + seed + ")"; window.status=out; timerTwo=window.setTimeout(cmd,speed);} else { window.status=" "; timerTwo=window.setTimeout("scrollit_r2l(100)",speed); } } } scrollit_r2l(100); // -- End of JavaScript code --> </script>
状态栏的世界时间第一步:把如下代码加入<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()"