As per mgibsonbr comment , URL masks are not a good idea. A better strategy is to validate the URL after losing focus with some kind of visual indication.
Since this type of validation strategy is not trivial, I suggest using one of the many libraries for validation. I especially recommend the jQuery validation library that has a method ready to treat urls. The strategy of this library is to make a first "lazy" validation when the field loses focus; if there is an error, the field will be actively validated during editing.
HTML
<form id="formulario">
<label for="minhaurl">Minha URL: </label>
<input id="minhaurl" name="minhaurl">
<!--...-->
</form>
JavaScript
$("#formulario").validate({
rules: {
minhaurl: {
required: true,
url: true
}
}
});