我有以下功能:
var index = 0;
var text = 'Hello world!';
function type() {
document.getElementById('screen').innerHTML += text.charAt(index);
index += 1;
var t = setTimeout('type()',200);
}
我想知道是否可以让它在单词 hello 和 world 之间添加一个 br 标签。
我试过这样:'hello' + br tag + 'world'; 但没有奏效,可能是因为charAt。
谢谢