高手帮下忙,看看这段代码···
各位Javascript友们 帮帮我给 这段代码 加上注释 看不大懂啊 谢谢各位了···刚来到这里分不多 谅解啊 谢谢 ····<body bgcolor="#fef4d9" OnLoad="stack()">
<SCRIPT LANGUAGE="JavaScript">
<!-- hide script from old browsers
var phrase = "精彩javascript特效!!!";
var lenPhrase = phrase.length; //获取字符串的长度
var phraseOut = "";
var pause = 25;//间隙 速度
var i=0;
var j=0;
var animateWidth = 20;//设置滚动宽度
var position=animateWidth;
function stack() {
if (phrase.charAt(i) != " ") {
phraseOut = "";
for (j=0; j<i; j++) {
phraseOut += phrase.charAt(j);
}
for (j=i; j<position; j++) {
phraseOut += " ";
}
phraseOut += phrase.charAt(i);
for (j=position; j<animateWidth; j++) {
phraseOut += " ";
}
window.status = phraseOut;
if (position == i) {
animateWidth++;
position = animateWidth;
i++;
}
else {
position--;
}
}
else {
i++
}
if (i<lenPhrase) {
setTimeout("stack()",pause);
}
}
// end hiding contents -->
</SCRIPT>
</body>