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.querySelector("#btn");
    btn.addEventListener("click", function() {
        clearInterval(timer)
    });
    function allstation() {
        document.querySelector("#main").innerHTML += "test "
    }
    var timeInterval = 1E3;
    var timer = setInterval(allstation, timeInterval)
});
  </script>
  </script>
</head>
<body>
<div id="main"></div>
<input id="btn" name="" type="button" value="stop">
</body>
</html>