Problem 6:form Validation Using JS: Program Code
Problem 6:form Validation Using JS: Program Code
AIM:
Create a HTML form and perform form validation using JS. Report errors using alert messages.
PROGRAM CODE:
dup.html <html>
<body>
<script>
function validateform()
{
var name=document.myform.name.value;
var password=document.myform.password.value;
var mobileno=document.myform.mobileno.value;
var emailid=document.myform.emailid.value;
if(password.length<6)
{
alert("Password must be at least 6 characters
long");
return false;
}
else
{
alert("successfully entetred the data");
}
}
</script>
<body style="background-color:lightgreen">
RESULT:
I created a HTML form and performed form validation using java script. It reported errors
through alert messages.After successfully entering the values it show a alert message saying
that “successfully entered the data”.