I’m very new to Javascript, so if I made any stupid mistakes, well, that’s why. ?
Here’s the function that doesn’t work, I need to validate the entry into the text box to make sure it’s a valid URL.
[code]
function valid() {
if (/^(http(s?)://|ftp://{1})((w+\.)+)w{2,}(/?)$/.test(urlbox.value)) }
alert(“DEBUG-working”);
javascript:changeFrame()
}
else {
alert(urlbox.value);
alert(“The website you entered was invalid.”);
field.focus();
field.select();
return false;
}
}
Can anyone tell me what’s wrong with the above code? It’s probably something with the regular expression (I think that’s what you call it), but I don’t know what.
All I really need is for it to check to make sure the string starts with http:, I don’t need it to work with https/ftp.
Thanks!