Home >Web Front-end >JS Tutorial >JavaScript method to achieve typing effect_javascript skills
The example in this article describes how JavaScript can achieve typing effects. Share it with everyone for your reference. The specific implementation method is as follows:
<input type="button" onclick='start("高考了")' value="start"/> <input type="text" id="here" /> <script type="text/javascript"> function start(str1) { str=str1; len=str.length; i=0; dwrite(); } function dwrite() { document.getElementById('here').value=document.getElementById('here').value + str.charAt(i); if( i++ ==len ) { i=0; return true; } setTimeout('dwrite()',500); } </script>
I hope this article will be helpful to everyone’s JavaScript programming design.