I want to give alerts when either of the two text fields are inputed wrong
<html>
<head>
<script type=“text/javascript”>
function validateForm()
{
var x=document.forms[“myForm”][“fname”].valu…
if (x==null || x=="")
{
alert(“First name must be filled out”);
return false;
}
}
{
var x=document.forms[“myForm”][“email”].valu…
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
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=“demo_form.asp” onsubmit=“return validateForm()” method=“post”>
First name: <br/><input type=“text” name=“fname”>
<br/>
Email:<br/> <input type=“text” name=“email”>
<input type=“submit” value=“Submit”>
</form>
</body>
</html>