L
Laiverd.COM
Hi, In the following function I keep getting a 'Object expected at line 75
char 5' but for the life of me I cannot find the error. Maybe someone would
be so kin to have a look? I indicated the 'problem' line below in the
function.
function checkEmail(f){
// check for a valid emailadress
var field = f;
// alert(field.value);
var str = field.value;
if (str == ""){
errors += "[ " + field.name.toUpperCase() + " ] is een verplicht veld.\n";
} else if (str != "") {
// if the browser supports window.RegExp
if (window.RegExp) {
var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
var reg2str =
"^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
var reg1 = new RegExp(reg1str);
var reg2 = new RegExp(reg2str);
if (!reg1.test(str) && reg2.test(str)){
// emailadress is correct
return true;
} else {
errors += "[ " + str + " ] is een onjuist emailadres.\n";
////////////////////////////////////////////// THIS IS SUPPOSED TO BE A
PROBLEM
return false;
}
// if the browser does not support window.RegExp
} else {
if(str.indexOf("@") >= 0){
errors += "[ " + str + " ] is een onjuist emailadres.\n";
}
}
}
}
Thanks for lending me your eyes and wisdom.
John
char 5' but for the life of me I cannot find the error. Maybe someone would
be so kin to have a look? I indicated the 'problem' line below in the
function.
function checkEmail(f){
// check for a valid emailadress
var field = f;
// alert(field.value);
var str = field.value;
if (str == ""){
errors += "[ " + field.name.toUpperCase() + " ] is een verplicht veld.\n";
} else if (str != "") {
// if the browser supports window.RegExp
if (window.RegExp) {
var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
var reg2str =
"^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
var reg1 = new RegExp(reg1str);
var reg2 = new RegExp(reg2str);
if (!reg1.test(str) && reg2.test(str)){
// emailadress is correct
return true;
} else {
errors += "[ " + str + " ] is een onjuist emailadres.\n";
////////////////////////////////////////////// THIS IS SUPPOSED TO BE A
PROBLEM
return false;
}
// if the browser does not support window.RegExp
} else {
if(str.indexOf("@") >= 0){
errors += "[ " + str + " ] is een onjuist emailadres.\n";
}
}
}
}
Thanks for lending me your eyes and wisdom.
John