Saratov64,
 
<!DOCTYPE html>
<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  </style>
  <script>
window.addEventListener("DOMContentLoaded", function() {
    var btn = document.querySelectorAll(".btn");
    btn[0].addEventListener("click", function() {
        clearInterval(timer);
        timer = setInterval(station1, timeInterval)
    });
    btn[1].addEventListener("click", function() {
        clearInterval(timer);
        timer = setInterval(station2, timeInterval)
    });
    function station1() {
        document.querySelector("#main").innerHTML += "1111 "
    }
    function station2() {
        document.querySelector("#main").innerHTML += "2222 "
    }
    var timeInterval = 1E3;
    var timer = setInterval(station1, timeInterval)
});
  </script>
  </script>
</head>
<body>
<div id="main"></div>
<input class="btn" name="" type="button" value="fn1">
<input class="btn" name="" type="button" value="fn2">
</body>
</html>