Thank you very much Meo and Nick, I put both your answers together and it works just great.
if(/^(http|https|ftp):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i.test($("#url").val())){
alert("valid URL");
} else {
alert("invalid URL");
}