Js一个一个显示文字
http://www.tywiki.com/index.php/MediaWiki:Common.js
<script> 这里是想要显示的文字,这里是想要显示的文字这里是想要显示的文字这里是想要显示的文字这里是想要显示的文字 </script> <!DOCTYPE html> <html lang="en">
<head>
<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title>
</head>
<body>
<script>
var pp = document.querySelector("p"); var str = "这里是想要显示的文字,这里是想要显示的文字这里是想要显示的文字这里是想要显示的文字这里是想要显示的文字" n = 0; var timer; timer = setInterval(function () { if (n < str.length) { pp.innerHTML += str.charAt(n);//sunstring(0,n) n++ } else { clearInterval(timer); } }, 100) </script>
</body>
</html>
https://blog.csdn.net/datuzidppd5556/article/details/99638105