title: How to update/change HTML content with JavaScript and prevent the page from refreshing?
body: <p>I'm a newbie to scripting.  I want to update HTML content with JavaScript, but as you can see
  the web page keeps refreshing.</p>
  
  <p>How can I prevent the page from refreshing?</p>
  
  <p><strong>Javascript:</strong></p>
  
  <pre><code>function showResult(form) {
  var coba=form.willbeshown.value;
  var coba2=coba+2;
  document.getElementById("showresulthere").innerHTML=coba2;
  }
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form&gt;
  &lt;input type="text" name="willbeshown" value=""&gt;
  &lt;button onclick="showResult(this.form)"&gt;Ganti1&lt;/button&gt;
  &lt;/form&gt;
  &lt;p id="showresulthere"&gt;Result will be shown here&lt;/p&gt;
  &lt;/body&gt;
  </code></pre>