-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.html
More file actions
37 lines (32 loc) · 1020 Bytes
/
options.html
File metadata and controls
37 lines (32 loc) · 1020 Bytes
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
<html>
<head><title>My Test Extension Options</title></head>
<script type="text/javascript">
// Saves options to localStorage.
function save_options() {
var name = document.getElementById("name");
localStorage["name"] = name.value;
console.log(localStorage["name"]);
// Update status to let user know options were saved.
var status = document.getElementById("status");
status.innerHTML = "Dades guardades";
setTimeout(function() {
status.innerHTML = "";
}, 750);
}
// Restores select box state to saved value from localStorage.
function restore_options() {
var favorite = localStorage["name"];
if (!favorite) {
return;
}
var name = document.getElementById("name");
name.value = favorite;
}
</script>
<body onload="restore_options()">
<div id='status'></div>
El teu nom:
<input type='text' id='name'></input>
<button onclick="save_options()">Save</button>
</body>
</html>