JS让你的标题栏<tilte>动起来:左右方向摇摆,效果支持中文
var message = new Array();
message[0] = "Meet your friends today !";
message[1] = "Meet your friends today !";
message[2] = "Triff deine Freunde, noch heute !";
message[3] = "Triff deine Freunde, noch heute !";
var reps = 2;
var speed = 150;
var p = message.length;
var T = "";
var C = 0;
var mC = 0;
var s = 0;
var sT = null;
if (reps < 1) reps = 1;
function doTheThing() {
T = message[mC];
A();
}
function A() {
s++;
if (s > 10) { s = 1;}
if (s == 1) { document.title = ' www.11jn.com _____ | '+T+' |'; }
if (s == 2) { document.title = '_1 www.1jn.com ____ | '+T+' |'; }
if (s == 3) { document.title = '__ www.11jn.com ___ | '+T+' |'; }
if (s == 4) { document.title = '___ www.11jn.com __ | '+T+' |'; }
if (s == 5) { document.title = '____ www.11jn.com _ | '+T+' |'; }
if (s == 6) { document.title = '_____ www.11jn.com | '+T+' |'; }
if (s == 7) { document.title = '____ www.11jn.com _ | '+T+' |'; }
if (s == 8) { document.title = '___ www.11jn.com __ | '+T+' |'; }
if (s == 9) { document.title = '__ www.11jn.com ___ | '+T+' |'; }
if (s == 10) { document.title = '_ www.11jn.com ____ | '+T+' |'; }
if (C < (10 * reps)) {
sT = setTimeout("A()", speed);
C++;
}
else {
C = 0;
s = 0;
mC++;
if(mC > p - 1) mC = 0;
sT = null;
doTheThing();
}
}
doTheThing();
</script>[/code]
很简单,复制上面的代码到你的网页HTML代码中,保存,访问即可看到效果。
别忘了替换上面代码中的www.11jn.com网址即可。