5月最近在学Django,所以所有的Demo都没有PO出去
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <script type="text/javascript"></script> <title>打印机效果</title> </head> <body> <pre class="aa"></pre> <div style="display:none" class="w">Hello World </div> <script> var index=0; var word=document.getElementsByClassName("w")[0].innerHTML; function type(){ document.getElementsByClassName("aa")[0].innerText = word.substring(0,index++); } setInterval(type, 200); </script> <!--记得引入jquery文件哦--> <script type="text/javascript" src="jquery-3.3.1.min.js"></script>