跑马灯

发布于 2021-09-17  329 次阅读


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <p id="paomadeng"></p>
</body>
</html>
<script>
    var str = 'Hello world!';

    function zifuchuan(){
        var first = str.slice(0,1);

        var last = str.slice(1,str.length);

        str = last + first;

        console.log(str);

        paomadeng.innerHTML = str;
    }
    setInterval(zifuchuan,500);

</script>