Monday, June 2, 2008

Javascript:Url Checking

function isURL(argvalue)
{
urlRegEx = /http[s]?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?/;

var testVal = argvalue.trim();

if(testVal.length > 9 && urlRegEx.test(testVal))
{
return true;

}
else
{
return false;
}
}

Usage

if(!isURL(document.getElementById(FinalControlID2).value))

No comments: