Time Validate : Form Validation « Form Control « JavaScript DHTML






Time Validate

  
<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
function check_it()
{
 var thetext=document.myForm.the_time.value;
 if (thetext.indexOf(":") == -1) {
      window.alert("Sorry, the time needs to have a colon (:) to be valid. Try again.");
      return false;
 } else {
     return true;
 }
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM name="myForm" action="#" onSubmit="return check_it();">
What time is it?<BR>
<INPUT type="text" name="the_time">
<BR>
<INPUT type="submit" value="Submit">
</BODY>

</HTML>
           
         
    
  








Related examples in the same category

1.Form Validator: time, date email, phone number, age etc
2.Form Validate: is blank, is digit and is integer
3.Log in form validation
4.Log in email validation
5.Comprehensive form validation
6.Illegal sub string validation
7.Email form validation
8.Form Validator
9.Form valiation for empty data, file name
10.Email Address Validate
11.URL Validate
12.Use JavaScript to check the password input
13.Form value validation and onsubmit action
14.Check form input value and alert user by change the control background