<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>opooc</title>

</head>
<style >
div{
    width: 800px;
    height: 30px;
    border:1px
    solid #ef3333;
    color: greenyellow;
}
</style>
<body>
<div id = "test"></div>
<script >
    var text = "我有一個夢想我有一個夢想我有一個夢想我有一個夢想";
    var num = text.length;

    var i =0;
    function show() {
        var shower = text.substr(0,i);
        document.getElementById("test").innerHTML = shower;
        i++;
        if(i + 1 >= num){
            clearInterval("done");
        }
    }
    var done=setInterval("show()",500);


</script>
</body>

</html>