Skip to content

Commit b768f0e

Browse files
authored
Merge pull request #189 from sonamgupta136/185-Basic-Contact-Form
185 basic contact form
2 parents bccba4c + a7498e2 commit b768f0e

File tree

5 files changed

+234
-63
lines changed

5 files changed

+234
-63
lines changed

Basic Contact Form/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<h1>Basic Contact Form</h1>
2+
3+
<p>A Basic Contact Form written in HTML, CSS and JAVASCRIPT .</p>
4+
5+
### Use of the Project:
6+
7+
<p>This basic contact form can be added to any website to make it attractive. </p>
8+
9+
<h3>Used Technologies</h3>
10+
<ul>
11+
<li>HTML5</li>
12+
<li>CSS3</li>
13+
<li>JavaScript</li>
14+
</ul>
15+
16+
#### Steps to Use:
17+
18+
---
19+
20+
- Download or clone the repository
21+
22+
```
23+
git clone https://github.com/Ayushparikh-code/Web-dev-mini-projects.git
24+
```
25+
26+
- Go to the directory
27+
- Run the index.html file
28+
- Result is here!!!
29+
30+
<h3> Screenshot:</h3>
31+
<img src="https://user-images.githubusercontent.com/66966120/125250300-ec32c500-e2aa-11eb-8a50-31d4cf729d72.png" alt="Screenshot (19)" style="max-width:100%;">
32+
33+
34+
<h3> Demo </h3>
35+
36+
<a href="https://sonamgupta136.github.io/Basic-Contact-Form.io/">Demo</a>
37+
38+
<br>

Basic Contact Form/app.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
let sendButton = document.getElementById('send');
2+
let resetButton = document.getElementById('reset');
3+
let form = document.getElementById('form');
4+
5+
6+
form.addEventListener('submit', function (e) {
7+
e.preventDefault();
8+
})
9+
10+
resetButton.addEventListener('click', function () {
11+
let name = document.getElementById('name');
12+
let email = document.getElementById('email');
13+
let message = document.getElementById('message');
14+
15+
name.value = '';
16+
email.value = '';
17+
message.value = '';
18+
})
19+
20+
sendButton.addEventListener('click', function (e) {
21+
let name = document.getElementById('name');
22+
let email = document.getElementById('email');
23+
let message = document.getElementById('message');
24+
25+
name = name.value;
26+
localStorage.setItem('name', name);
27+
28+
email = email.value;
29+
localStorage.setItem('email', email);
30+
31+
message = message.value;
32+
localStorage.setItem('message', message);
33+
34+
})
35+

Basic Contact Form/index.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<link rel="stylesheet" href="style.css">
9+
<title>Contact Form</title>
10+
</head>
11+
12+
<body>
13+
<form id="form">
14+
<h1>Please Contact me</h1>
15+
<div>
16+
<label for="name">Name</label></br>
17+
<input id="name" name="name">
18+
</div>
19+
<div>
20+
<label for="email">Email</label><br>
21+
<input type="email" id="email" name="email">
22+
</div>
23+
<div>
24+
<label for="message">Message</label><br>
25+
<textarea id="message" name="message"></textarea>
26+
</div>
27+
<div id="buttons-row">
28+
<div class="buttons">
29+
<button type="submit" id="send">Send</button>
30+
</div>
31+
<div class="buttons">
32+
<button id="reset">Reset</button>
33+
</div>
34+
</div>
35+
</form>
36+
<script src="app.js"></script>
37+
</body>
38+
39+
</html>
40+

Basic Contact Form/style.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
form {
2+
background-color: black;
3+
width: 500px;
4+
border-radius: 25px;
5+
height: 400px;
6+
padding: 25px;
7+
font-family: Arial, Helvetica, sans-serif;
8+
box-sizing: border-box;
9+
margin: 50px auto 50px;
10+
11+
}
12+
13+
form h1 {
14+
color: white;
15+
text-align: center;
16+
font-size: 22px;
17+
}
18+
19+
label {
20+
color: rgb(43, 134, 209);
21+
font-weight: bold;
22+
padding-bottom: 5px;
23+
padding-top: 15px;
24+
display: inline-block;
25+
}
26+
27+
input,
28+
textarea {
29+
box-sizing: border-box;
30+
width: 450px;
31+
height: 30px;
32+
padding-left: 5px;
33+
font-family: Arial, Helvetica, sans-serif;
34+
}
35+
36+
textarea {
37+
height: 50px;
38+
}
39+
40+
#buttons-row {
41+
display: flex;
42+
justify-content: space-evenly;
43+
}
44+
45+
button {
46+
flex-grow: 1;
47+
width: 125px;
48+
margin: 25px;
49+
border: none;
50+
border-radius: 15px;
51+
height: 35px;
52+
font-size: 20px;
53+
}
54+
55+
button#send {
56+
background-color: rgb(211, 59, 59);
57+
color: white;
58+
}
59+
60+
button#reset {
61+
background-color: rgb(253, 253, 54);
62+
color: black;
63+
}
64+

0 commit comments

Comments
 (0)