使用js实现简单的打字效果
作者:互联网
<div class="box"></div> <script> var div = document.querySelector('div'); var str = "我叫刘少辉,我爱你们" ; var index = 0 function write() { if (index < str.length) { div.innerHTML += str[index]; index++; } } setInterval(write.bind(),200) </script>
标签:index,效果,200,打字,js,write,str,var,div 来源: https://www.cnblogs.com/liushaohui/p/15953739.html