<script LANGUAGE="JavaScript">
var MessageText = "欢迎光临--政府网网站"
var DisplayLength = 260
//给 DisplayLength 初值260
var pos = 1 - DisplayLength;
//pos = 1-260 = -259
function ScrollInStatusBar()
{
var scroll = "";
pos++;
//pos=pos+1,第一次执行的时候就是-259+1=-258,第二次执行的时候就是-258+1=-257,第三次……
if (pos == MessageText.length) //如果pos等于"欢迎光临--政府网网站"的长度
pos = 1 - DisplayLength; //pos=1-260=-259
if (pos<0)//不用说了吧
{
for (var i=1; i<=Math.abs(pos); i++)//循环执行下面语句pos的绝对值次
scroll = scroll + " "; //在scroll后面加空位
scroll = scroll + MessageText.substring(0, DisplayLength - i + 1);
//把scroll跟MessageText连在一起,substring(开始位置,长度)是取子字符串的意思
//比如 aa="abcdefg"; aa.substring(0,2)等于"ab"
}
else
scroll = scroll + MessageText.substring(pos, pos + DisplayLength);
window.status = scroll;
setTimeout("ScrollInStatusBar()",50); //每50毫秒执行一次ScrollInStatusBar()函数
}
ScrollInStatusBar()
</script>
//最终的效果应该是“欢迎光临--政府网网站”串字符来来回回的飘吧
一点愚见,见笑了