check for valid email using javascript
<p>I am able to check for empty field but how do I also check for the valid email checking regular expression? here is what I have so far</p>

<pre><code>&lt;script&gt;
function validateForm()
{
var x=document.forms["myForm"]["fname"].value;
if (x==null || x=="")
  {
  alert("First name must be filled out");
  return false;
  }
var y=document.forms["myForm"]["email"].value;
if (y==null || y=="")
  {
  alert("email must be filled out");
  return false;
  }
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post"&gt;
First name: &lt;input type="text" name="fname"&gt;&lt;br&gt;
email: &lt;input type="text" name="email"&gt;

&lt;br&gt;&lt;br&gt;
&lt;input type="submit" value="Submit"&gt;
&lt;/form&gt;
</code></pre>
