35) How to validate email in JavaScript?

function validateemail()
{
var x=document.myform.email.value;
var atposition=x.indexOf(“@”);
var dotposition=x.lastIndexOf(“.”);
if (atposition<1 || dotposition=x.length){
alert("Please enter a valid e-mail address \n atpostion:"+atposition+"\n dotposition:"+dotposition);
return false;
}
}

Email: