-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
41 lines (38 loc) · 1.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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Weather App</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<style media="screen">
/* Challenge footer */
.attribution { font-size: 11px; text-align: center; margin: 0;}
.attribution a { color: hsl(228, 45%, 44%); }
</style>
</head>
<body class="text-center">
<h1>Weather App</h1>
<form class="form mt-5 mb-5" action="/" method="post">
<label class="label" for="cityInput">City Name:</label>
<input class="input" id="cityInput" type="text" name="cityName" value="">
<button class="btn btn-primary" type="submit">Go</button>
</form>
<script>
var query = location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
console.log(query);
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == 'cityName') {
document.querySelector("#cityInput").setAttribute("value", decodeURIComponent(pair[1]));
console.log(decodeURIComponent(pair[1]));
}
}
</script>
<footer>
<p class="attribution">Challenge created by <a href="https://www.appbrewery.co/" target="_blank">The App Brewery</a>.</p>
<p class="attribution">Coded by <a href="https://arpadgbondor.github.io/CV/" target="_blank">Árpád Gábor Bondor</a> in 2020.</p>
</footer>
</body>
</html>