Validating e-mail address
<p>I am trying to validate an e-mail address using javascript. The problem is the if statements aren't executing correctly. If I delete the 'else statement' the code runs correnctly and the page does not load with errors. If I include the 'else statement' the else statement never executes and the status bar says that the page loads with errors. I was wondering if anyone can find any errors that I am unable to pick up?</p>

<pre><code>&lt;h4&gt;Example 4:&lt;/h4&gt;
&lt;div style="border:3px dashed #aaa; width:200px;"&gt;
    &lt;div id="text"&gt;e-mail: &lt;input id="email" onblur="verifyEmail()"/&gt;&lt;/div&gt;
    &lt;div id="verification" &gt; &lt;/div&gt;
&lt;/div&gt;

&lt;script type="text/javascript"&gt;
function verifyEmail(){
    var email = document.getElementById("email").value;
    var atPos=0;
     var dotPos=0;

    atPos = email.indexOf("@");
    dotPos = email.lastIndexOf(".");

    if(atPos&lt;=3 || dotPos&lt;atPos+2 || dotPos+2&gt;=email.length){
        document.getElementById("verification").innerHTML = "Invalid E-mail Address";
    }else{
        document.getElementById("verification").innerHTML = "Valid";
    }

}



&lt;/script&gt;
</code></pre>
