call all functions to submit form
<p>I'm new to JavaScript and am looking on how to validate my form on button click, but my script keeps jumping to the first function validate Name an stays highlighted, I don't know what to put in the clear all function so it jumps to the next non validated item</p>

<pre><code>function validate_form(form)
{
    var complete=false;

    if(complete)
    {
        clear_all();
        complete = checkUsernameForLength(form.username.value);
    }
    if(complete)
    {
        clear_all();
        complete = checkaddress(form.address.value);
    }
    if(complete)
    {
        clear_all();
        complete = checkaddress(form.address.value);
    }

    if (complete)
    {
        clear_all();
        complete = checkphone(form.phone.value);
    }
    if (complete)
    {
        clear_all();
        complete = checkEmail(email.phone.value);
    }
}

function clear_all()
{
    document.getElementById('usernamehint').style.visibility= 'hidden';
    document.basicform.username.style.backgroundColor='white';
    document.getElementById("countryhint").style.visibility= 'hidden';
    document.basicform.country.style.backgroundColor='white';
    document.getElementById("").style.visibility= 'hidden';
    document.basicformm.address.style.backgroundColor='white';
    document.getElementById("").style.visibility= 'hidden';
    document.basicform.phone.style.backgroundColor='white';
    document.getElementById("").style.visibility= 'hidden';
    document.basicform.email.style.backgroundColor='white';
}

function checkUsernameForLength(whatYouTyped)
{
    var fieldset = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;
    if (txt.length &gt; 2) {
        fieldset.className = "welldone";
        return true;
    } else {
        fieldset.className = "";
        return false;
    }
}

function checkEmail(whatYouTyped) 
{
    var fieldset = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt)) {
        fieldset.className = "welldone";
    } else {
        fieldset.className = "";
    }
}



function checkaddress(whatYouTyped)
 {
    var fieldset = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;
    if (txt.length &gt; 3 &amp;&amp; txt.length &lt;10) {
        fieldset.className = "welldone";
    }
     else {
        fieldset.className = "";
    }
}



function checkphone(whatYouTyped)
 {
    var fieldset = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;
 if ( /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/.test(txt)) {
        fieldset.className = "welldone";
    }
 else
 {
        fieldset.className = "";
    }
}



function addLoadEvent(func) 
{
  var oldonload = window.onload;
  if (typeof window.onload != 'function') 
{
    window.onload = func;
  }
 else
 {
    window.onload = function()
 {
      oldonload();
      func();
    }
  }
}


function prepareInputsForHints() 
{
  var inputs = document.getElementsByTagName("input");
  for (var i=0; i&lt;inputs.length; i++)
{
    inputs[i].onfocus = function () 
{
      this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
    }
    inputs[i].onblur = function () 
{
      this.parentNode.getElementsByTagName("span")[0].style.display = "none";
    }
  }
}
</code></pre>
