码迷,mamicode.com
首页 > 其他好文 > 详细

控制文字动态输出

时间:2018-06-29 10:53:41      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:world   col   color   class   set   get   tin   style   har   

<!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>

 

控制文字动态输出

标签:world   col   color   class   set   get   tin   style   har   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!