Time Validate : JavaScript DHTML examples (example source code) » Form Control » Form Validation

JavaScript DHTML














Java Products
Java Articles
JavaScript DHTML Home  »   Form Control   » [  Form Validation  ]   

 
Time Validate

Please note that some example is only working under IE or Firefox.

/*
JavaScript: A Beginner's Guide, Second Edition
By John Pollock

Publisher: McGraw-Hill, 

Published December 2003, 550 pages, 
ISBN 0072227907
*/

<HTML>

<HEAD>

<SCRIPT language="JavaScript">
<!--

function check_it()
{
 var thetext=document.f1.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="f1" 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








Home| Contact Us
Copyright ?2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.