title: javascript form validation - reloading of page
body: <p>I have a form with some fields on.  I am still learning Javascript.  When my  is submitted it triggers my JS which checks if the fields was submitted and then displays the errors in a  which is done through innerhtml. Problem is it only display's the div for a few seconds and then finishes reloading the page and the div is not displayed anymore.</p>
  
  <pre><code>function checkradio() {
  chosen = ""
  len = document.cv.Radio1.length
  for (i = 0; (i&lt;2); i++) {
  if (document.cv.Radio1[i].checked) {
  chosen = document.cv.Radio1[i].value
  }
  }
  if (chosen == "") {
  document.getElementById('error-1').innerHTML = "Please choose a type";
  document.getElementById("Radio1").focus();
  }
  }
  </code></pre>