Javascript “写作”;“互动及时”;使用JS脚本在html页面上显示文本
我正在尝试制作一个Javascript,它将自动在html页面上“及时”写入文本。作为一个例子,我希望它写“Hello world”,但每一秒一封信 如果您知道任何这样的代码的例子,我可以看看,我会非常高兴 谢谢。试试这个:Javascript “写作”;“互动及时”;使用JS脚本在html页面上显示文本,javascript,Javascript,我正在尝试制作一个Javascript,它将自动在html页面上“及时”写入文本。作为一个例子,我希望它写“Hello world”,但每一秒一封信 如果您知道任何这样的代码的例子,我可以看看,我会非常高兴 谢谢。试试这个: var index = 0; var hello = "hello world"; function write() { document.write(hello.substr(index,1)); index++; if(index >= h
var index = 0;
var hello = "hello world";
function write()
{
document.write(hello.substr(index,1));
index++;
if(index >= hello.length)
{
clearInterval(i);
}
}
setInterval(write, 1000);
通常被称为a-谷歌是你的朋友,请随时依靠它在需要的时候。