URL Validate : Form Validation « Form Control « JavaScript DHTML






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
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