0
16kviews
Write JavaScript program to validate a form which accepts Name, Age, Email and Phone Number of a student.
1 Answer
0
2.4kviews
<!DOCTYPE html>
<html>
<head>
<title>Student Information Form</title>
<script type="text/javascript">
function valid() 
{
var na = document.getElementById("nm").value;
var ag = document.getElementById("age").value;
var em = document.getElementById("eid").value.indexOf("@");
var mno = document.getElementById("pno").value;
if(na==""||na==null)
{
alert("Enter The Name");
return false;
}
else if(isNaN(ag)||ag<1||ag>100)
{
alert("The age must be a number between 1 and 100");
return …

Create a free account to keep reading this post.

and 5 others joined a min ago.

Please log in to add an answer.