Skip to content

Commit 0da4299

Browse files
authored
Merge pull request #34 from rajeshwari269/main
booking1.html
2 parents e113975 + 29f5a0c commit 0da4299

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

booking1.html

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Ride Booking</title>
7+
<style>
8+
body {
9+
font-family: Arial, sans-serif;
10+
display: flex;
11+
justify-content: center;
12+
align-items: center;
13+
height: 100vh;
14+
background: #eef2f7;
15+
}
16+
.booking-container {
17+
background: #fff;
18+
padding: 30px;
19+
border-radius: 12px;
20+
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
21+
width: 350px;
22+
}
23+
.booking-container h2 {
24+
text-align: center;
25+
margin-bottom: 20px;
26+
}
27+
.booking-container input, .booking-container select {
28+
width: 100%;
29+
padding: 12px;
30+
margin: 8px 0;
31+
border: 1px solid #ccc;
32+
border-radius: 8px;
33+
}
34+
.booking-container button {
35+
width: 100%;
36+
padding: 12px;
37+
margin-top: 10px;
38+
background: #007BFF;
39+
color: white;
40+
border: none;
41+
border-radius: 8px;
42+
cursor: pointer;
43+
}
44+
.booking-container button:hover {
45+
background: #0056b3;
46+
}
47+
.error {
48+
color: red;
49+
font-size: 14px;
50+
}
51+
</style>
52+
</head>
53+
<body>
54+
<div class="booking-container">
55+
<h2>Book a Ride</h2>
56+
<form id="bookingForm">
57+
<input type="text" id="pickup" placeholder="Pickup Location" required>
58+
<input type="text" id="drop" placeholder="Drop-off Location" required>
59+
<input type="datetime-local" id="rideDate" required>
60+
<button type="submit">Book Ride</button>
61+
<p id="errorMsg" class="error"></p>
62+
</form>
63+
</div>
64+
65+
<script>
66+
document.getElementById("bookingForm").addEventListener("submit", function(event) {
67+
event.preventDefault();
68+
69+
let pickup = document.getElementById("pickup").value.trim();
70+
let drop = document.getElementById("drop").value.trim();
71+
let rideDate = document.getElementById("rideDate").value;
72+
let errorMsg = document.getElementById("errorMsg");
73+
74+
errorMsg.textContent = "";
75+
76+
if (pickup === "" || drop === "") {
77+
errorMsg.textContent = "Pickup and drop-off locations are required.";
78+
return;
79+
}
80+
81+
if (pickup.toLowerCase() === drop.toLowerCase()) {
82+
errorMsg.textContent = "Pickup and drop-off cannot be the same.";
83+
return;
84+
}
85+
86+
let selectedDate = new Date(rideDate);
87+
let now = new Date();
88+
if (selectedDate < now) {
89+
errorMsg.textContent = "Please select a future date and time.";
90+
return;
91+
}
92+
93+
alert("Ride booked successfully from " + pickup + " to " + drop + "!");
94+
document.getElementById("bookingForm").reset();
95+
});
96+
</script>
97+
</body>
98+
</html>

0 commit comments

Comments
 (0)