表白
<body>
<!-- copy内容,将原文章的内容一行一行打印出来 -->
<p id="copy"></p>
<p id="article" style="display:none;">
我是小雨,你在哪儿?
我爱你,
你爱我吗?
爱 ❤
-----《不能说的秘密》By Gentle.Gee
</p>
<script>
var copy = document.getElementById('copy'),
article = document.getElementById('article'),
k=1;
function fun(){
// console.log(k)
if(k<=article.innerText.length){
copy.innerText=article.innerText.substring(0,k++)
}else{
clearInterval(timer)
}
}
var timer=setInterval(fun,100)
</script>
</body>