本文實例講述了JavaScript實現打字效果的方法。分享給大家供大家參考。具體實現方法如下:
<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>
希望本文所述對大家的javascript程序設計有所幫助。
新聞熱點
疑難解答