please help. I'm not asking you to create the program just please tell me what I'm missing. This is for self studying. I am trying to make a javascript program that would do this: 1. alert user if no name or email had been created 2. email data must contain an @ sign and at least one dot (.). Also, the @ must not be the first character of the email address, and the last dot must be present after the @ sign, and minimum 2 characters before the end. My code:
 <html>
 <head>
 <script type="text/javascript">
 function validateForm1()
 {
 var y=document.forms["myForm"]["email"].value;
 var atpos=y.indexOf("@");
 var dotpos=y.lastIndexOf(".");
 var x=document.forms["myForm"]["fname"].value;
 if (x==null || x=="" ||  y=="")
 {
 alert("First name and Email must be filled out");
 return false;
 }
 else if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
 {
 alert("Not a valid e-mail address");
 return false;
}
}
 </script>
 </head>
 <body>
<form name="myForm" action=# onsubmit="return validateForm1()" method="post">
 First name: <input type="text" name="fname"><br/>
Email: <input type="text" name="email"><br/>
<input type="submit" value="Submit">
</form>
</body>
</html>
 
     
     
     
    