JS实现HTML打印机效果
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>
Win a contest, win a challenge
posted on 2018-05-10 17:11 pandaboy1123 阅读(1132) 评论(0) 编辑 收藏 举报