首页 > 其他 > 详细

控制文字动态输出

时间:2018-06-29 10:34:57      阅读:141      评论:0      收藏:0      [点我收藏+]
<!doctype html>
<html>
<head>
<meta charset="gb2312">

<title>控制文字动态输出</title>

</head>

<body>


<input  type="text" id="fswt_nr" class="fl" placeholder="请输入您的问题" name="tel">

<script>

    var index=0;
    var str=document.getElementById("fswt_nr").placeholder;
    function type(){
    if(index==str.length+1){
        index=0;
    }
    document.getElementById("fswt_nr").placeholder = str.substring(0,index++);
    }
    setInterval(type, 500);
    

</script>

<p></p>
<p></p>
<p></p>
<p></p>

<p id="ddff">The furthest distance in the world.Is not between life and death.But when I stand in front of you.Yet you don‘t know that I love you</p>


<script>

    var two=0;
    var strtwo=document.getElementById("ddff").innerHTML;
    function typetwo(){
    if(two==strtwo.length+1){
        two=0;
    }
    document.getElementById("ddff").innerHTML = strtwo.substring(0,two++);
    }
    setInterval(typetwo, 500);
    

</script>





</body>
</html>

 

控制文字动态输出

原文:https://www.cnblogs.com/linyusong/p/9241819.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!