Javascript form validation
<p>I'm wondering, Is there a JavaScript command (whats the proper name for the thing im looking for?) where I can select all input boxes in a form rather than just one?</p>

<p>E.g:</p>

<pre><code> function checkform(id){
var theForm = document.getElementById( id );
if (theForm.surname.value == '') {
  alert( "you didn't type in your surname");
  theForm.surname.focus();
  return false;
}
else if (theForm.surname.value.length == 0) {
  alert( 'You\'ve left some of the fields blank' );
  theForm.surname.focus();
  return false;
}
return true;
}
</code></pre>

<p>I have this code. The purpose of it is that it checks each input box in the form to see if information has been entered, and if it hasn't, an alert appears when the user submits the form.</p>

<p>Is there a way I could change this piece of JavaScript in order to check every input box and not just the surname one (as seen in the example).</p>
