|
|
|
|
状态栏里的跑马灯
摘自 网络教学
请您注意浏览器“状态栏”,要实现这种效果只要将下面代码加入HTML中的<head>和</head>之间,其中的文字可改为您自己需要的内容。
<script language="JavaScript">
<!--
function scroll(seed)
{
var m1 = "欢迎您访问《初学者园地》"
var m2 = "这里的栏目有Frontpage教程,JAVASCRIPT实例教程,希望对您有所帮助 "
var msg=m1+m2;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
var cmd="scroll(" + seed + ")";
timerTwo=window.setTimeout(cmd,60);
}
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,60);
} 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,60);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scroll(40)",60);
}
}
}
timerONE=window.setTimeout('scroll(40)',60);
//-->
</script>
|