Hi,
thanks for the regx expression; unfortunately I'm a total newbie at JS, and
don't know how to integrate it into my form-checker. could i set up this
function to run "onblur" for each of my form entries, to halt form execution
if it detects "http"...? If so, how can I set up the expression to test
specific field contents; example if the field in question is "form1.name" ?
My normal checking functions follow this syntax:
if (document.form1.name.value == "")
{
alert("Please enter your name.");
form1.name.focus();
return false;
}
Thanks!
MC
<> wrote in message
news: oups.com...
> You can use a regular expression:
> http://msdn.microsoft.com/library/en...gexpsyntax.asp
> to look for patterns.
>
> function hasHTTP(value)
> {
> var regx= new RegExp("\bhttp\:\/\/\w","ig"); // looks for
> (separator)http://(letter|number) (case insensitive)
> return regx.test( value);
> }
>
> "http://test" hasHTTP() returns True
> "http:// test" hasHTTP() returns False
> "in a string of charactershttp://test" hasHTTP() returns False
> "http://" hasHTTP() returns False
>
>
> or if you only want look for "http"
> {
> var regx= new RegExp("http","g"); // looks for http (case
> sensitive)
> return regx.test( value);
> }
>