Saturday, March 5, 2011

Validation

 <script language="javascript">  
 <!--  
 Function CheckForm(form)  
 {  
  for(var intCtr = 0; intCtr <= (form.elements.length - 5); ++intCtr)  
  {  
   var temp = form.elements[intCtr];  
   if(temp.type == "text" && temp.value == "")  
   {  
   alert("Please Enter All Information!");  
    temp.focus();  
    return false;  
   }  
  }  
  return true;  
 }  
 //-->  
 </script>  

This sample piece of JavaScript does some validation, but it doesn't check for all the in-formation that you might need on the form you are building.

No comments:

Post a Comment