Stopping action if requirements are not met
<p>I want to check the validation of two text boxs if either one is empty. It showed show an error as an innerHTML and if they are both filled in. It will then continue to action. Here is my code:</p>

<pre><code>function go()
{
  var toCheck = document.getElementById('myAnchor');
  if (toCheck != '') {
     return true;
  }
  else 
  {
    document.getElementById('myAnchor').innerHTML = 'Fred Flinstone';
  }
}
</code></pre>

<p>this does set the innerHTML but still continues with the action. How can I stop it from continuing?</p>

<p>Thank you!</p>
