javascript当中跑马灯的作用

跑马灯

例 1.9.3(PaoMaDengSelfIEFF.html)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
    <script type="text/javascript">
        var str="welcome to my website";
        var i=1;
        function pao()
        {
            window.setInterval(repCode,1000);
        }
        function repCode()
        {
            document.getElementById("sp").innerHTML= str.substring(0,i);
 //           window.status= str.substring(0,i);
            i++;
            if(i==str.length) i=1;
        }
    </script>
</head>
<body οnlοad="pao()">
<span id="sp"></span>
</body>
</html>
setTimeout&clearInterval

更多内容请见原文,文章转载自:https://blog.csdn.net/qq_43650923/article/details/103052283

posted @ 2021-12-03 11:12  malala  阅读(17)  评论(0编辑  收藏  举报