-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
85 lines (71 loc) · 2.56 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Car Saling Website</title>
</head>
<body>
<div class="header" id="header">
<nav>
<img src="images/logo.png" alt="" class="logo">
<ul>
<li> <a href="#" id="models">Model S</a> </li>
<li> <a href="#" id="model3">Model 3</a> </li>
<li> <a href="#" id="modelx">Model X</a> </li>
<li> <a href="#" id="modely">Model Y</a> </li>
</ul>
<a href="#" class="btn">Rserve Now</a>
</nav>
<div class="info">
<div>
<h2 class="seconds">1.9 s</h2>
<p class="speed">60 mph</p>
</div>
<div>
<h2 class="top-power">200 mph</h2>
<p class="top-speed">Top Speed</p>
</div>
<div>
<h2 class="max-power"> 396 mi</h2>
<p class="max-range"> Max Range</p>
</div>
<div class="line">
</div>
<div>
<h2 id="model">Model S</h2>
</div>
</div>
</div>
<script>
var header = document.getElementById("header");
var ms = document.getElementById("models");
var m3 = document.getElementById("model3");
var mx = document.getElementById("modelx");
var my = document.getElementById("modely");
var model = document.getElementById("model");
var seconds = document.getElementsByClassName("seconds");
var speed = document.getElementsByClassName("speed");
ms.onclick = function(){
header.style.backgroundImage = "url(images/image-1.png)";
model.innerHTML = "Model S";
}
m3.onclick = function(){
header.style.backgroundImage = "url(images/image-2.png)";
model.innerHTML = "Model 3";
seconds.innerHTML = "1.9s";
speed.innerHTML = "200mph";
}
mx.onclick = function(){
header.style.backgroundImage = "url(images/image-3.png)";
model.innerHTML = "Model X";
}
my.onclick = function(){
header.style.backgroundImage = "url(images/image-4.png)";
model.innerHTML = "Model Y";
}
</script>
</body>
</html>