title: Page refreshes after javascript function
body: <p>After I excecute my JS function over onClick button method. My site refreshes and everything that was writen with innerHTML is erased. I think i'm missing something. I will just put the whole JS function here. I probably don't understand something and that's what is causing it.    </p>
  
  <pre><code>function stisk() {
    var stevilo = prompt("Vnesi iskano stevilo");
    var seznam = document.getElementById("vnos").value;
    var pattern = new RegExp("^[0-9](,\s*[0-9])+$");
    var vsota = 0;
    var seznam = seznam.split(',');
  
    var dolzina = seznam.length;
    var pravilnost = pattern.test(seznam);
    if (pravilnost == true) {
      for (i = 0; i &lt; dolzina; i++) {
        vsota = vsota + parseInt(seznam[i]);
      }
      for (i = 0; i &lt; dolzina - 1; i++) {
        var star = document.getElementById("stevila").innerHTML;
        if (isNaN(seznam[i]) == false) {
          var starejsi = document.getElementById("stevila").innerHTML = star + parseInt(seznam[i]) + "+";
        } else {
          document.getElementById("stevila").innerHTML = "Vnos ni pravilen";
        }
      }
      document.getElementById("stevila").innerHTML = starejsi + seznam[dolzina - 1] + "=" + vsota;
      var c = 0;
      for (i = 0; i &lt; seznam.length; i++) {
        if (stevilo == seznam[i]) {
          c++;
        }
      }
      if (c == 0) {
        alert("stevila ni na seznamu");
      } else {
        alert("Stevilo je na seznamu");
      }
    } else {
      document.getElementById("stevila").innerHTML = "Napacen vnos stevil";
    }
  }
  </code></pre>
  
  <p><strong>HTML:</strong>
  <img src="https://i.imgur.com/iqWAlAh.jpg" alt="HTML">
  <strong>Here is the browser view:</strong></p>
  
  <p><img src="https://i.imgur.com/pKughN7.jpg" alt="example"></p>
  
  <p><strong>After i press "V redu" (OK) Everything goes back to the start, expacting me to write a number inside. I want the 2+3+4=9 to stay there if that is possible? Thanks</strong></p>