<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script></script>
</head>
<body>
    <button class="start" >开启定时器</button>
    <button class="stop">关闭定时器</button>
    <script>
        var start=document.querySelector('.start');
        var stop=document.querySelector('.stop');
        var start_timer_one=null;
        function start_timer(){
            start_timer_one=setInterval(()=>{
                console.log('定时器已经开启');
            },1000);
        }
        function stop_timer(){
            clearInterval(start_timer_one);
        }
        start.addEventListener('click',start_timer);
        stop.addEventListener('click',stop_timer);
    </script>
</body>
</html>