定时器 间隔调用setInterval

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>定时器 间隔调用setInterval</title>
    <!-- 
        setInterval("代码a",n);每隔n毫秒后执行以此代码a
        clearInterval();清除间隔调用
     -->
</head>
<body>
    <script>
        var x;
        x=setInterval("console.log('每秒打印一次')",1000);//设置间隔调用
        setTimeout("clearInterval(x)",3000);//设置延时调用:在3秒后清除间隔调用
    </script>
</body>
</html>
上一篇:babel-polyfill


下一篇:javascript-setinterval说未定义函数,但它是