URL Validate : Form Validation : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » 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>

           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» Form Validation