Code:
<form method="post" name="reg" action="" onSubmit="return validateForm()"  >
 
   <table align="center" class="register_form_table">
   
   <tr><td colspan="2"> 
   
   
  

   </td></tr>
    <tr valign="baseline">
      <td nowrap align="right">Username * </td>
      <td><input type="text" name="username" value="" size="32"></td>
    </tr>
     <tr valign="baseline">
       <td nowrap align="right">Password*</td>
       <td>
       
       <input type="password" name="password" id="pwd" value="" size="32"  maxlength="8"></td>
     </tr>
     <tr valign="baseline">
       <td nowrap align="right">Retype Password*</td>
       <td>
       
       <input type="password" name="re_password" value="" size="32" id="conPwd" maxlength="8" onChange="checkMatchPwd();"><br>
       
<div id="txtCheckPwd" class="registrationFormAlert"><p>&nbsp;</p></div></td>
     </tr>
     <tr>
       <td colspan="2"><div class="form_dvdr"></div></td></tr>
      <tr valign="baseline">
       <td nowrap align="right">Title</td>
       <td> 
       
      
 

 
 
       
       </td>
     </tr>
     <tr valign="baseline">
       <td nowrap align="right">First Name*</td>
       <td><input type="text" name="firstname" value="" size="32"></td>
     </tr>
     <tr valign="baseline">
       <td nowrap align="right">Last Name*</td>
       <td><input type="text" name="lastname" value="" size="32"></td>
     </tr>
     
      <tr>
       <td colspan="2"><div class="form_dvdr"></div></td></tr>
     <tr valign="baseline">
       <td nowrap align="right">Email Address*</td>
       <td><input type="text" name="email" value="" size="32"></td>
     </tr>
     <tr valign="baseline">
       <td nowrap align="right">Phone*</td>
       <td><input type="text" name="phone" value="" size="32"></td>
     </tr><tr valign="baseline">
       <td nowrap align="right">Address*</td>
       <td><input type="text" name="address" value="" size="32"></td>
     </tr>
     <tr valign="baseline">
       <td nowrap align="right">Postcode*</td>
       <td><input type="text" name="postcode" value="" size="32"></td>
     </tr>
     
     <tr valign="baseline">
       <td nowrap align="right">City*</td>
       <td><input type="text" name="city" value="" size="32"></td>
     </tr>
     
      <tr>
       <td colspan="2"><div class="form_dvdr"></div></td></tr>
     
     <tr valign="baseline">
       <td nowrap align="right">Date of birth*</td>
       <td><input type="text" name="dob" value="dd/mm/yyyy" size="32"></td>
     </tr>
     <tr valign="baseline">
       <td nowrap align="right">Gender*</td>
       <td>
       Male<input name="gender" id="gender_male" type="radio" value="male">
       Female <input type="radio" id="gender_female" name="gender" value="female" ></td>
     </tr>
     
     <tr valign="baseline">
       <td nowrap align="right">&nbsp;</td>
       <td align="right"><input  type="submit" value="Insert record" name="submit"  ></td>
     </tr>
   </table>
   <input type="hidden" name="usergroup" value="member">
 </form>


Code:

// JavaScript Document//

 function validateForm()
{
var a=document.forms["reg"]["username"].value;


var b=document.forms["reg"]["password"].value;
 


var c=document.forms["reg"]["firstname"].value;
var d=document.forms["reg"]["lastname"].value;
var e=document.forms["reg"]["email"].value;
var f=document.forms["reg"]["phone"].value;
var g=document.forms["reg"]["address"].value;
var h=document.forms["reg"]["postcode"].value;
var i=document.forms["reg"]["city"].value;
var j=document.forms["reg"]["dob"].value;
var k=document.forms["reg"]["gender"].value;


if (
(a==null || a=="") && 
(b==null || b=="") && 
(c==null || c=="") &&
(d==null || d=="") &&
(e==null || e=="") && 
(f==null || f=="") && 
(h==null || h=="")&&
(i==null || i=="")&&
(j==null || j=="") &&
(k==null || k=="")
	)
  {
  alert("All Fields must be filled out");
  return false;
  }
if (a==null || a=="")
  {
  alert("username name must be filled out");
  return false;
  }


//password validation  


if (b==null || b=="")
  {
  alert("password must be filled out");
  return false;
  }
  
  
 
  
  
	  
	  
  
 if (c==null || c=="")
  {
  alert("firstname name must be filled out");
  return false;
  }
if (d==null || d=="")
  {
  alert("lastname must be filled out");
  return false;
  }
if (e==null || e=="")
  {
  alert("email must be filled out");
  return false;
  }
if (f==null || f=="")
  {
  alert("phone must be filled out");
  return false;
  }
if (g==null || g=="")
  {
  alert("address must be filled out");
  return false;
  }
if (h==null || h=="")
  {
  alert("postcode must be filled out");
  return false;
  }
  
  if (i==null || i=="")
  {
  alert("city must be filled out");
  return false;
  }if (j==null || j=="")
  {
  alert("dob must be filled out");
  return false;
  }
  
 
  
  
x=document.getElementById('gender_male');
y=document.getElementById('gender_female');
  
if(!x.checked && !y.checked)
{
	alert('please select gender');
	return false;
}


}












 function checkMatchPwd()
  {
	  var password=$('#pwd').val();
	  var confirmPassword=$('#conPwd').val();
	  
	  if(password != confirmPassword)
	  
		 { 
		 $('#txtCheckPwd').html('*Password does not match!!');
		 		 
		 }
		 
		 
	else 
	     {
			 $('#txtCheckPwd').html('*Passwords match.');
			 }
		 
  }
	$(document).ready(function()
	{
        $('#conPwd').keyup(checkMatchPwd);
	  
    });