“Js一个一个显示文字”的版本间的差异
(创建页面,内容为“https://blog.csdn.net/datuzidppd5556/article/details/99638105”) |
|||
(未显示同一用户的5个中间版本) | |||
第1行: | 第1行: | ||
+ | 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> | ||
+ | |||
+ | <p></p> | ||
+ | <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 | https://blog.csdn.net/datuzidppd5556/article/details/99638105 |
2019年12月7日 (六) 12:47的最新版本
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