Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试制作一个 Javascript,它将自动在 html 页面上编写“及时”的文本。作为一个例子,我希望它每秒写一个“Hello world”,但一次写一个字母。
如果您知道我可以查看的此类代码的任何示例,我将非常高兴。
谢谢你。
尝试这个:
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);