-
Notifications
You must be signed in to change notification settings - Fork 1
/
wifi.html
62 lines (54 loc) · 1.74 KB
/
wifi.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
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
</head>
<body>
<h1>Set the WiFi Info:</h1>
<div class="row">
<form class="col-md-6" onsubmit="setWiFi()">
<div class="form-group">
<label for="wifiName">WiFi SSID</label>
<input type="text" class="form-control" id="wifiName" placeholder="WiFi SSID" required>
</div>
<div class="form-group">
<label for="wifiPassword">WiFi Password</label>
<input type="text" class="form-control" id="wifiPassword" placeholder="WiFi Password" required>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<div class="col-md-6">
<h2>Current Values:</h2>
<div>
<div>
<strong>WiFi Name:</strong> <span id="wifiNameValue"></span>
</div>
<div>
<strong>WiFi Password:</strong> <span id="wifiPasswordValue"></span>
</div>
</div>
</div>
</div>
<div>
<h3><a href="/">Back to slides...</a></h3>
</div>
<script language="JavaScript">
function setWiFi() {
["Name", "Password"].forEach(function(name) {
var value = document.getElementById("wifi" + name).value;
localStorage.setItem("wifi" + name, value);
});
console.log(localStorage)
}
function displayCurrentSettings() {
["Name", "Password"].forEach(function(name) {
var value = localStorage["wifi" + name];
document.getElementById("wifi" + name + "Value").innerText = value || "nothing";
});
}
displayCurrentSettings();
</script>
</body>
</html>