-
Notifications
You must be signed in to change notification settings - Fork 0
/
parkinglot.html
55 lines (53 loc) · 1.53 KB
/
parkinglot.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
<!DOCTYPE html>
<html lang="en">
<head>
<script>
function myFunction(){
var arr1 = [];
var arr2 = [];
var a = document.getElementById("cars").value;
var b = 3;
var c = document.getElementById("slot").value;
var d = document.getElementById("hours").value;
if(a== '' || b== '' || c=='' || d== ''){
alert("Enter all the required fields");
}
else{
if(c > b){
alert("Required slot is not available");
}
arr1[1]= 2;
arr1[2] = 3;
arr1[3] = 2;
if(d>0 && d<=2){
var cost = 20;
alert("Your vehicle type is " + a);
alert("Your vehicle cost is 20 rupees");
}
else if(d>2 && d<=4){
var cost = 40;
alert("Your vehicle type is " + a);
alert("Your vehicle cost is 40 rupees");
}
else {
var cost = 60;
alert("Your vehicle type is " + a);
alert("Your vehicle cost is 60 rupees");
}
}
}
}
</script>
</head>
<body>
<h1> Parking Lot Management Application </h1><br>
<p>Types of Vehicles : <select name="cars" id="cars" required>
<option value="Two-Wheeler">Two-Wheeler</option>
<option value="Hatchback Car">Hatchback Car</option>
<option value="SUV Car">SUV Car</option>
</select></p><br>
<p>Which slot you want to park this vehicle : <input type="number" id="slot" required></p><br>
<p>How many hours you want to park <input type="number" id="hours" required></p><br>
<button type="submit" onclick = "myFunction()">Submit</button>
</body>
</html>