Form validation is not working
<p>Here is my code :</p>

<p>when after i entered name and email the form validation isn't performing.What should i do to validate the user entered data.And i would to like to move to another jsp page of name start.jsp when i click on Participate Kindly help me to get rid of this and please tell me what and why itsn't working..</p>

<pre><code> &lt;html&gt;
&lt;head&gt;
&lt;title&gt;Aptitude Competition Online&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="index.css"&gt;
&lt;script language="javascript"&gt;
function isEmpty(str) { 
if(str=="" )
{
return true;
} else return false;
}
function validate() {  
var nam = document.form[0].name.value; 
var ema = document.form[0].email.value; 
 if(isEmpty(nam)) 
  { 
       alert(Name should be filled out"); 
       document.form[0].name.focus;
       return false;
  }
 else if(isEmpty(ema) 
  {
       alert(E-mail should be filled out"); 
       document.form[0].email.focus;  
       return false;  
  } 
  else {  
       return true; 
       } 
       } 
  &lt;/script&gt; 
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="header1"&gt;
  &lt;font id="font1"&gt;Aptitude Quiz&lt;/font&gt;
  &lt;/div&gt;
  &lt;div id="email"&gt;
  &lt;div id="inside"&gt;
  &lt;font id="font2"&gt;Welcome to Aptitude Quiz&lt;/font&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
   &lt;form name="form"&gt;
   Name : &lt;input type="text" name="name"&gt;&lt;br&gt;&lt;br&gt;
   E-mail : &lt;input type="text" name="email"&gt;&lt;br&gt;&lt;br&gt;
   &lt;input name="Participate" type="button" value="Participate"          onClick="validate()"&gt;&lt;br&gt;&lt;br&gt;
   &lt;/form&gt;
   &lt;/div&gt;
    &lt;/div&gt;
     &lt;div id="footer"&gt;
      Contact Us : gmail@name.com 
      &lt;/div&gt;
       &lt;/body&gt;
      &lt;/html&gt;
</code></pre>