Std 12th IT Subject - Skill Oriented Practical (Science Stream)
Create JavaScript program for the following form validations. Make use of HTML5 properties to do the following validations :

<!doctype html>
<html>
<head>
<title>Applicaiton Form</title>
</head>
<script type="text/javascript">
function validateemail() {
var str = f1.e1.value;
var dotpositon = str.lastIndexOf(".");
var atposition = str.indexOf("@");
if (atposition < 1 || dotpositon < atposition + 2 || dotpositon + 2 > str.length) {
alert("Please Enter a valid email Id");
}
}
</script>
<body>
<h1>Information Form</h1>
<form name="f1" onsubmit="validateemail()">
Enter Your Name: <input type="text" name="t1" required><br><br>
Enter Address: <textarea name="a1" cols="30" rows="2" placeholder="permanent address"></textarea><br><br>
Enter Contact No: <input type="tel" max="10" name="c1" required><br><br>
Enter Email: <input type="text" name="e1" required><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>