为什么文本不使用此功能滚动?

时间:2016-09-25 01:12:50

标签: javascript scroll

使用此代码,返回的歌曲名称保持静态

var temp;
function scrollon(f) {

 temp = f.substring(0,1);
 f += temp;
 f = f.substring(1,f.length);
 document.wow.display.value = f.substring(0,f.length);
 setTimeout("scrollon()",200);
}

虽然按要求滚动

var temp;
var f = "Closing Time is now playing ";

function scrollon() {

 temp = f.substring(0,1);
 f += temp;
 f = f.substring(1,f.length);
 document.wow.display.value = f.substring(0,f.length);
 setTimeout("scrollon()",200);
}

关于我做错了什么的任何建议?

1 个答案:

答案 0 :(得分:1)

尝试从

更改您的代码
setTimeout("scrollon()",200); 

setTimeout("scrollon('"+f+"')", 200);

因为您使用参数创建函数。您需要再次传递参数。