<!doctype html> <html> <head> <meta charset="gb2312"> <title>控制文字动态输出</title> </head> <body> <input type="text" id="fswt_nr" class="fl" placeholder="请输入您的问题" name="tel"> <script> var index=0; var str=document.getElementById("fswt_nr").placeholder; function type(){ if(index==str.length+1){ index=0; } document.getElementById("fswt_nr").placeholder = str.substring(0,index++); } setInterval(type, 500); </script> <p></p> <p></p> <p></p> <p></p> <p id="ddff">The furthest distance in the world.Is not between life and death.But when I stand in front of you.Yet you don't know that I love you</p> <script> var two=0; var strtwo=document.getElementById("ddff").innerHTML; function typetwo(){ if(two==strtwo.length+1){ two=0; } document.getElementById("ddff").innerHTML = strtwo.substring(0,two++); } setInterval(typetwo, 500); </script> </body> </html>