<pre id="aa"></pre>
<div style="display:none" id="w">1,2,3,4,5,6,7 </div>
<input type="button" value="显示2" onclick="type1()" />
<script language="javascript">
var index=0; var word=document.getElementById("w").innerHTML; var set ;
function type1(){
set = setInterval(function(){
document.getElementById("aa").innerHTML = word.substring(0,index++);
if(index > 19){ clearInterval(set); }
}, 500); }
</script>