文字逐个出现效果
文字一个个出现的demo
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <pre id="showWord"></pre> <div style="display:none" id="word"> xxxxxxxxxxxxxxxxxxxxx </div> <script language="javascript"> var index=0; var word=document.getElementById("word").innerHTML; function type(){ document.getElementById("showWord").innerText = word.substring(0,index++); } setInterval(type, 200); </script> </body> </html>