JS做网页动态标题

动态标题

怎样才能让标题栏动起来呢

<SCRIPT language=JavaScript> 
var message = new Array(); 
message[0] = " 一个低调的帅哥 "; 
var reps = 1; 
var speed = 300;// 设置短句输入频率(数字越大频率越慢). 
var hold = 4 // 设置重新输入前显示整个短语的时间长度(数字越大时间越长)
var p = message.length; 
var q = 0; 
var r = 0; 
var C = 0; 
var mC = 0; 
var s = 0; 
var sT = null; 
if (reps < 1) { 
reps = 1; 
} 
function setMessage() { 
typing = message[mC]; 
q = typing.length; 
r = q + hold; 
typeMessage(); 
} 
function typeMessage() { 
if (s > r) { 
s = 0; 
} 
if (s > q) { 
document.title = '冷小鱼'+ typing +'QWQ'; 
} 
else { 
document.title = '冷小鱼'+ typing.substr(0,s)+'QWQ'; 
} 
if (C < (r * reps)) { 
sT = setTimeout("typeMessage()", speed); 
C++; 
s++; 
} 
else { 
C = 0; 
s = 0; 
mC++; 
if(mC > p - 1) {mC = 0;} 
sT = null; 
setMessage(); 
} 
} 
setMessage(); 
</SCRIPT>
点赞

发表评论