Give code Email Checking

Answers were Sorted based on User's Feedback



Give code Email Checking..

Answer / bharani kumar

var ree;
ree=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(ree.test(document.formname.txt_email.value)==false){
alert("Enter valid email id");
document.formname.txt_email.value = "";
document.formname.txt_email.focus();
return false;
}

Is This Answer Correct ?    2 Yes 0 No

Give code Email Checking..

Answer / dennis

How about using regular expressions for brevity

Is This Answer Correct ?    1 Yes 0 No

Give code Email Checking..

Answer / rajender

function isEmail (s) {
if (isEmpty(s))
if (isEmail.arguments.length == 1) return defaultEmptyOK;
else return (isEmail.arguments[1] == true);
if (isWhitespace(s)) return false;
var i = 1;
var sLength = s.length;
while ((i < sLength) && (s.charAt(i) != "@")) {
i++
}
if ((i >= sLength) || (s.charAt(i) != "@")) return false;
else i += 2;
while ((i < sLength) && (s.charAt(i) != ".")) {
i++
}
if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
else return true;
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More JavaScript Interview Questions

How to accessing elements using javascript?

0 Answers  


What is object cloning

3 Answers  


What is the use of type of operator?

0 Answers  


How much does a javascript developer make?

0 Answers  


Explain the for-in loop?

0 Answers  






What is isnan in javascript?

0 Answers  


Can I learn javascript without html?

0 Answers  


How do I activate javascript on my phone?

0 Answers  


Can array in javascript be extended?

0 Answers  


Are there any iphone Institutes which also train iphone automation testing in Hyderabad?

0 Answers  


How use javascript html?

0 Answers  


What is the function of delete operator?

0 Answers  


Categories