0% found this document useful (0 votes)
3 views1 page

Cod Java

The document is an HTML form titled 'Information Form' that collects user data including name, address, contact number, and email. It includes a JavaScript function to validate the email format before submission. The validation checks for the presence of '@' and '.' in the email and provides feedback to the user accordingly.

Uploaded by

yadavanand654
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Cod Java

The document is an HTML form titled 'Information Form' that collects user data including name, address, contact number, and email. It includes a JavaScript function to validate the email format before submission. The validation checks for the presence of '@' and '.' in the email and provides feedback to the user accordingly.

Uploaded by

yadavanand654
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

<!

DOCTYPE html>
<html>
<head>
<title>SOP 2 JavaScript</title>
</head>
<body>
<h1>Information Form</h1>
<form name="f1">
Your Name : <input type="text" name="txt_name" required><br><br>
Address : <textarea name="txt_address" placeholder="Permanent
Address"></textarea><br><br>
Contact<input type="tel" name="telephone" maxlength="10" required><br><br>
Email<input type="email" name="txt_email" pattern="[A-Z a-z]{0-9}-[@]{1}-[.]{1}"
required><br><br>
<input type="button" name="b1" value="submit" onClick="validate_email()">
</form>
<br>
<p id="result"></p>
<script type="text/javascript">
function validate_email()
{
var x=f1.txt_email.value;
var at_pos=[Link]("@");
var last_pos=[Link]("@");
var firstdot_pos=[Link](".");
var dot_pos=[Link](".");
if
(at_pos<1||dot_pos<at_pos+2||dot_pos+2>=[Link]||firstdot_pos<at_pos||at_pos<last_
pos)
{
[Link]("result").innerHTML="Not an Valid email address";
document.f1.txt_email.focus();
}
else
{
[Link]("result").innerHTML="Valid email address";
return true;
}
}
</script>
</html>

You might also like