function LTrim( value ) {
var re = /\s*((\S+\s*)*)/;
return value.replace(re, "$1");
}
// Removes ending whitespaces
function RTrim( value ) {
var re = /((\s*\S+)*)\s*/;
return value.replace(re, "$1");
}
// Removes leading and ending whitespaces
function trim( value ) {
return LTrim(RTrim(value));
}
function Emailcheck()
{
var common = 'ctl00_ContentPlaceHolder1_ctl03_';
var wholestring = document.getElementById(common+'txtMerchantEmail').value;
var lblErrorPersonalInfo = document.getElementById(common+"lblErrorPersonalInfo");
var splitChar;
splitChar=";";
var col_array=wholestring.split(splitChar);
var part_num=0;
while (part_num < col_array.length)
{
var trimedString = trim(col_array[part_num]);
if(trimedString.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)=="-1")
{ lblErrorPersonalInfo.innerHTML ="Either the email addresses are not ';' separated or one or more email addresses are not valid.";
return false;
break;
}
part_num+=1;
}
return true;
}
Friday, November 21, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment