您的位置:寻梦网首页编程乐园JavaScriptJavaScript实例
跑马灯一

知道您有没有注意到,在有些首页的最下方,常常会看见一排字咕噜咕噜的冒出来(低头看看本页的状态列吧!),知道那是怎麽做的吗?把下列这东西加进去就可以罗!(先用滑鼠将下面标记起来,按左键复制到首页中即可!)紫色的部份可自己填进去,记得要把这些语句加在<title>######</title>之後!
<SCRIPT LANGUAGE="JavaScript">
<!--
function scroll(seed)
{
var m1 = "欢迎光临"
var m2 = "中国网虫俱乐部 "
var msg=m1+m2;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
var cmd="scroll(" + seed + ")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
var cmd="scroll(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
} else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
var cmd="scroll(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,100);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scroll(100)",7);
}
}
}
timerONE=window.setTimeout('scroll(100)',50);
//-->
</SCRIPT>