表单提示字符如何一个一个的出来

<input id='qingshuo' type='text' placeholder='请输入您要咨询的问题……' />
<script>
$(function(){
    var input_hz=0;
    var input_hz1=document.getElementById("qingshuo").placeholder;
    function type(){
        if(input_hz==input_hz1.length+1){
            input_hz=0;
        }
        document.getElementById("qingshuo").placeholder = input_hz1.substring(0,input_hz++);
    }
    setInterval(type, 300); 
})
</script>

效果图

猜你喜欢

转载自www.cnblogs.com/lcxin/p/10851404.html