How to validate url in java script
url validation in java scrip
How to validate url in java script
url validation in java scrip
How to validate url in java script
This function can be used for validating url
function isURL(s) { var regexp = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/; return regexp.test(s); }
<html> <head> </head> <script language="javascript"> function isURL(s) { var regexp = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/; alert(regexp.test(s)); } </script> <body> <form> <input type="text" name="url" size="20" id="url"/> <input type="button" value="Validate"
onClick="javascript:isURL(document.getElementById('url').value);"/> </form> </body> </html>
No comments:
Post a Comment