-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDHA.html
More file actions
237 lines (205 loc) · 6.97 KB
/
DHA.html
File metadata and controls
237 lines (205 loc) · 6.97 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sell Your Used Car Instantly | Trusted Car Selling Site</title>
<style>
/* Global Styles */
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f7f8fa;
margin: 0;
padding: 0;
color: #333;
}
h1, h2 {
text-align: center;
color: #2c3e50;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
/* Header Section */
header {
background-color: #007bff;
color: white;
padding: 20px 0;
text-align: center;
font-size: 24px;
}
/* Form Styles */
.form-card {
background-color: white;
padding: 30px;
margin: 20px 0;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.form-group {
margin: 10px 0;
}
input, button {
width: 100%;
padding: 12px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
button {
background-color: #28a745;
color: white;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #218838;
}
/* Car Listings */
.car-listing {
display: flex;
flex-direction: column;
gap: 20px;
margin-top: 30px;
}
.car-item {
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
}
.car-img {
width: 150px;
height: 100px;
object-fit: cover;
border-radius: 5px;
margin-right: 20px;
}
.car-info {
flex: 1;
}
.car-info strong {
font-size: 18px;
display: block;
}
.car-info span {
color: #777;
}
.remove-btn {
background-color: #dc3545;
color: white;
padding: 10px 15px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.remove-btn:hover {
background-color: #c82333;
}
footer {
background-color: #343a40;
color: white;
text-align: center;
padding: 10px;
margin-top: 40px;
}
</style>
</head>
<body>
<header>
Sell Your Used Car Instantly - Most Trusted Car Selling Site
</header>
<div class="container">
<!-- Form for listing cars -->
<div class="form-card">
<h2>List Your Car for Instant Sale</h2>
<div class="form-group">
<input type="text" id="make" placeholder="Car Make" required>
</div>
<div class="form-group">
<input type="text" id="model" placeholder="Car Model" required>
</div>
<div class="form-group">
<input type="number" id="year" placeholder="Car Year" required>
</div>
<div class="form-group">
<input type="number" id="price" placeholder="Car Price (e.g., 15000)" required>
</div>
<div class="form-group">
<input type="file" id="carImage" accept="image/*" required>
</div>
<button onclick="addCar()">List My Car</button>
</div>
<!-- Car Listings Section -->
<h2>Available Cars for Instant Purchase</h2>
<div class="car-listing" id="car-list"></div>
</div>
<footer>
© 2024 Trusted Car Selling Site | Sell Your Car with Confidence
</footer>
<script>
// Store car listings
let carListings = [];
// Function to add car to the list
function addCar() {
const make = document.getElementById('make').value;
const model = document.getElementById('model').value;
const year = document.getElementById('year').value;
const price = document.getElementById('price').value;
const carImageFile = document.getElementById('carImage').files[0];
if (!make || !model || !year || !price || !carImageFile) {
alert('Please fill all fields and upload an image.');
return;
}
const reader = new FileReader();
reader.onload = function(event) {
const carImage = event.target.result;
const car = { make, model, year, price, carImage };
// Add car to the listings
carListings.push(car);
// Display the updated car listings
displayCars();
// Clear the form
document.getElementById('make').value = '';
document.getElementById('model').value = '';
document.getElementById('year').value = '';
document.getElementById('price').value = '';
document.getElementById('carImage').value = '';
};
reader.readAsDataURL(carImageFile);
}
// Function to display car listings
function displayCars() {
const carList = document.getElementById('car-list');
carList.innerHTML = '';
if (carListings.length === 0) {
carList.innerHTML = '<p>No cars available for sale at the moment.</p>';
return;
}
carListings.forEach((car, index) => {
const carItem = document.createElement('div');
carItem.classList.add('car-item');
carItem.innerHTML = `
<img src="${car.carImage}" alt="Car Image" class="car-img">
<div class="car-info">
<strong>${car.year} ${car.make} ${car.model}</strong>
<span>Price: $${car.price}</span>
</div>
<button class="remove-btn" onclick="removeCar(${index})">Remove</button>
`;
carList.appendChild(carItem);
});
}
// Function to remove car from the list
function removeCar(index) {
carListings.splice(index, 1);
displayCars();
}
</script>
</body>
</html>