home

Javascript Form Validation Tutorial


Form Validation

<script type="text/javascript">
function validateform(form1)
{
if("" == document.forms.form1.name.value)
{
alert("Please enter your name")
form1.name.focus()
return false
}
if("" == document.forms.form1.email.value)
{
alert("Please enter your email")
form1.email.focus()
return false
}
if("" == document.forms.form1.message.value)
{
alert("Please enter your message")
form1.message.focus()
return false
}
}
</script>


 function validateform(form1)
 {
  if("" == document.forms.form1.name.value)
  {
   alert("Please enter your name")
   form1.name.focus()
   return false
  }
  if("" == document.forms.form1.email.value)
  {
   alert("Please enter your email")
   form1.email.focus()
   return false
  }
  if("" == document.forms.form1.message.value)
  {
   alert("Please enter your message")
   form1.message.focus()
   return false
  }
 }
     

Name:*

 

Email:*

 

Message:*

 

 

 

 

 


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Copyright © 2014 by Cramerz.com.