<body onload="movestatus();return true;">
<script language="JavaScript">
<!--
var activetext="这就是跑马灯的效果";
var textlength=activetext.length;
var width=100;
var pos=1-width;
function movestatus()
{
pos++;
var scroller="";
if (pos==textlength)
{pos=1-width;}
if (pos<0)
{
for (var i=1;i<=Math.abs(pos);i++)
{scroller=scroller+"";
}
scroller=scroller+activetext.substring(0,width-i+1);
}
else
{
scroller=scroller+activetext.substring(pos,width+pos);
}
window.status=scroller;
window.setTimeout("movestatus()",1000);
}
//-->
</script>
</body>
<script language="JavaScript">
<!--
var activetext="这就是跑马灯的效果";
var textlength=activetext.length;
var width=100;
var pos=1-width;
function movestatus()
{
pos++;
var scroller="";
if (pos==textlength)
{pos=1-width;}
if (pos<0)
{
for (var i=1;i<=Math.abs(pos);i++)
{scroller=scroller+"";
}
scroller=scroller+activetext.substring(0,width-i+1);
}
else
{
scroller=scroller+activetext.substring(pos,width+pos);
}
window.status=scroller;
window.setTimeout("movestatus()",1000);
}
//-->
</script>
</body>
你把 scroller=scroller+activetext.substring(0,width-i+1);放在FOR里面所以在状态栏中出现很多啦!