function ValidateWebAddress(field,alerttext)
{
with(field)
{
var companyUrl =value;
var RegExp = /^(([w]+:)?//)?(([dw]|%[a-fA-fd]{2,2})+(:([dw]|%[a-fA-fd]{2,2})+)?@)?([dw][-dw]{0,253}[dw].)+[w]{2,4}(:[d]+)?(/([-+_~.dw]|%[a-fA-fd]{2,2})*)*(?(&?([-+_~.dw]|%[a-fA-fd]{2,2})=?)*)?(#([-+_~.dw]|%[a-fA-fd]{2,2})*)?$/;
i f(RegExp.test(companyUrl)) {
return true;
}
else
{
alert(alerttext);
return false;
}
}
}
Call this fuction in an if else structure
Pass the field name and an alert string
if(validate_r(website,"Need to specify your site")==false)
{
return false;
}