Skip to content
Permalink
8218248ffb
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
91 lines (75 sloc) 2.31 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Website Contact Form</title>
</head>
<body>
<form method="post" id="myForm" name="myForm">
<h1>Website Contact Form</h1>
<p>Required fields are followed by <strong><abbr title="required">*</abbr></strong>.</p>
<section>
<h2>Contact information</h2>
<p>
<label for="name">
<span>Name: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="text" id="name" name="user">
</p>
<p>
<label for="mail">
<span>E-mail: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="email" id="mail" name="usermail">
</p>
<p>
<label for="sbj">
<span>Subject:</span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="subject" id="msg" name="subject">
</p>
<label for="msg">
<span>Message: </span>
<strong><abbr title="required">*</abbr></strong>
</label>
<input type="message" id="msg" name="message">
</p>
</section>
<section>
<button><a href="#" id="Submit" onclick="myfunction"()>Submit</a></button>
</section>
</form>
<script>
//btnSubmit.addEventListener('click', () => {
function myfunction(){
if (document.myform.user.value== ""){
alert("Please fill out your name");
document.myForm.user.focus();
return false;
}
if(document.myform.usermail.value=="") {
alert("enter email");
document.myForm.usermail.focus();
return false;
}
if(document.myform.subject.value=="") {
alert("enter subject");
document.myForm.subject.focus();
return false;
}
if(document.myform.message.value=="") {
alert("enter message");
document.myForm.message.focus();
return false;
}
else{
alert("submit form"); return true;
}
}
//document.getElementById("myForm").submit();
</script>
</body>
</html>