-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
142 lines (133 loc) · 4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AdalBadal - The Old Barter</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
header {
background: #333;
color: #fff;
padding-top: 30px;
min-height: 70px;
border-bottom: #0779e4 3px solid;
}
header a {
color: #fff;
text-decoration: none;
text-transform: uppercase;
font-size: 16px;
}
header ul {
padding: 0;
list-style: none;
}
header li {
float: left;
display: inline;
padding: 0 20px 0 20px;
}
header #branding {
float: left;
}
header #branding h1 {
margin: 0;
}
header nav {
float: right;
margin-top: 10px;
}
.main-content {
padding: 20px;
background: #fff;
margin-top: 20px;
}
.post-ad, .view-ads {
margin-bottom: 20px;
}
.ad-item {
background: #e2e2e2;
padding: 10px;
margin-bottom: 10px;
}
footer {
background: #333;
color: #fff;
text-align: center;
padding: 10px;
margin-top: 20px;
}
</style>
</head>
<body>
<header>
<div class="container">
<div id="branding">
<h1>AdalBadal - The Old Barter</h1>
</div>
<nav>
<ul>
<li><a href="#post-ad">Post Ad</a></li>
<li><a href="#view-ads">View Ads</a></li>
</ul>
</nav>
</div>
</header>
<div class="container main-content">
<section id="post-ad" class="post-ad">
<h2>Post an Ad</h2>
<form id="postAdForm">
<label for="itemOffered">Item Offered:</label>
<input type="text" id="itemOffered" name="itemOffered" required>
<br><br>
<label for="itemWanted">Item Wanted:</label>
<input type="text" id="itemWanted" name="itemWanted" required>
<br><br>
<label for="contact">Contact Information:</label>
<input type="text" id="contact" name="contact" required>
<br><br>
<input type="submit" value="Post Ad">
</form>
</section>
<section id="view-ads" class="view-ads">
<h2>View Ads</h2>
<div id="adsContainer">
<!-- Ads will be dynamically added here -->
</div>
</section>
</div>
<footer>
<p>AdalBadal © 2024</p>
</footer>
<script>
const postAdForm = document.getElementById('postAdForm');
const adsContainer = document.getElementById('adsContainer');
postAdForm.addEventListener('submit', function(e) {
e.preventDefault();
const itemOffered = document.getElementById('itemOffered').value;
const itemWanted = document.getElementById('itemWanted').value;
const contact = document.getElementById('contact').value;
const adItem = document.createElement('div');
adItem.className = 'ad-item';
adItem.innerHTML = `
<p><strong>Item Offered:</strong> ${itemOffered}</p>
<p><strong>Item Wanted:</strong> ${itemWanted}</p>
<p><strong>Contact:</strong> ${contact}</p>
`;
adsContainer.appendChild(adItem);
postAdForm.reset();
});
</script>
</body>
</html>