URL Validate : Form Validation : Form Control : JavaScript DHTML examples (example source code) Organized by topic

JavaScript DHTML
C++
PHP


JavaScript DHTML  »  Form Control   » [  Form Validation  ]   
 



URL Validate

<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
function check_it() {
     var theurl=document.myForm.t1.value;
     var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
     if (tomatch.test(theurl))
     {
         window.alert("URL OK.");
         return true;
     }
     else
     {
         window.alert("URL invalid. Try again.");
         return false
     }
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM name="myForm" action="#" onSubmit="return check_it();">
Enter URL:<BR>
<INPUT type="text" name="t1">
<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.  Time Validate
























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