<html>
<head></head>
<body>
<span id = "word">hello,word!hello,word!hello,word!hello,word!hello,word!</span>
<script>
var word = document.getElementById("word");
var str = word.innerHTML;
var len = word.length,step = 0;
var timer = setInterval (function(){
step ++;
word.innerHTML = str.substring(0,step) + (step & 1 ? '_' : '');
if(step >= str.length ){
clearInterval(timer);
}
},75);
</script>
</body>
</html>
逐字输入效果
最新推荐文章于 2024-02-28 22:54:36 发布