大侠们请帮帮忙 这下边这段代码,我有个小地方看不懂 ,帮我标注下 好吗 谢谢了
<script LANGUAGE="JavaScript">
var MessageText = "欢迎光临--政府网网站"
var DisplayLength = 260
var pos = 1 - DisplayLength;
function ScrollInStatusBar(){
var scroll = "";
pos++;
if (pos == MessageText.length) pos = 1 - DisplayLengthif (pos<0) {
for (var i=1; i<=Math.abs(pos); i++)
scroll = scroll + ""; //这个的作用是什么哦?
scroll = scroll + MessageText.substring(0, DisplayLength - i + 1);
}
else
scroll = scroll + MessageText.substring(pos, pos + DisplayLength);
window.status = scroll;
setTimeout("ScrollInStatusBar()",50);
}
ScrollInStatusBar()
</script>
參考答案:>>scroll = scroll + ""; //这个的作用是什么哦?
操作符+ 连接两个字符串
比如"ab"+"c"的结果是"abc"
你那句话的意思同理:scroll这个变量代表的字符串内容+空字符串