定时器 setInterval(‘function()’, 2000)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        function f1(){
            console.log(1)
        }
        //创建一个定时器
        setInterval('f1();', 2000);

    </script>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/my-love-is-python/p/9291512.html