This script is supposed to check if the submitted value is an Url but it doesn't do that. I'm not too familiar with regex and my buddy who made this for me is away for a trip.
<script type="text/javascript">// <![CDATA[
window.onload=init;
function init(){
document.forms[0].onsubmit= function (){
var url= document.getElementById("url").value;
var desc= document.getElementById("description").value;
var regex=new RegExp("^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$");
var match=regex.test(url);
if(!match)
{
alert("The URL you entered is not valid");
return false;
}
if(desc.length<10)
{
alert("There must be at least 10 characters in the description");
return false;
}
};
}
// ]]></script>