forked from apu52/Travel_Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plantrip.html
164 lines (141 loc) · 4.87 KB
/
plantrip.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trip Planner</title>
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
<style>
body {
font-family: 'Nunito Sans', sans-serif;
background-color: #b1e5f748;
margin: 0;
padding: 0;
}
header {
background-color: #091020;
color: #fff;
text-align: center;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
transform: scale(1.00);
height: 60px;
}
.nav__logo {
font-size: 1.75rem;
font-weight: 600;
color: #ffffff;
text-decoration: none; /* Remove underline from link */
}
.nav__logo span {
color: #3685fb;
}
h1{
padding-right: 690px;
text-align: center;
}
form {
max-width: 600px;
margin: 20px auto;
background-color: #add8e6e3;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}
label {
display: block;
margin-bottom: 8px;
font-weight: bold;
}
input,
select {
width: 100%;
padding: 10px;
margin-bottom: 16px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-weight: bold;
font-family: inherit;
}
button {
background-color: #4c854e;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
font-weight: bold;
font-family: inherit;
transition: transform 0.3s ease-in-out;
}
button:hover {
background-color: #87af89;
transform: scale(1.15);
}
select {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
/* Add custom dropdown arrow */
background-repeat: no-repeat;
background-position: right 10px top 50%;
background-size: 24px auto;
padding-right: 30px;
font-weight: bold;
font-family: inherit;
}
select:focus {
border-color: #4CAF50;
outline: none;
}
</style>
<script>
function handleSubmit(event) {
event.preventDefault();
const today = new Date(); // Get today's date
const startDate = new Date(document.getElementById('startDate').value);
const endDate = new Date(document.getElementById('endDate').value);
if (endDate < startDate) {
alert('End date cannot be earlier than start date.');
} else if (startDate < today || endDate < today) {
alert('Start and end dates cannot be earlier than today.');
} else {
alert('Trip planned successfully!');
// You can proceed to submit the form or perform other actions here
// For demonstration, form submission is prevented.
}
}
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('tripForm').addEventListener('submit', handleSubmit);
});
</script>
</head>
<body>
<header>
<a href="index.html" class="nav__logo" data-aos="fade-right">Tourguide<span>.</span></a>
<h1>Trip Planner</h1>
</header>
<form id="tripForm">
<label for="destination">Destination:</label>
<input type="text" id="destination" name="destination" required>
<label for="startDate">Start Date:</label>
<input type="date" id="startDate" name="startDate" required>
<label for="endDate">End Date:</label>
<input type="date" id="endDate" name="endDate" required>
<label for="budget">Budget:</label>
<input type="number" id="budget" name="budget" required>
<label for="accommodation">Accommodation:</label>
<select id="accommodation" name="accommodation">
<option value="hotel">Hotel</option>
<option value="apartment">Apartment</option>
<option value="hostel">Hostel</option>
</select>
<button type="submit">Plan My Trip</button>
</form>
</body>
</html>