-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocuments.html
More file actions
75 lines (56 loc) · 1.69 KB
/
Copy pathdocuments.html
File metadata and controls
75 lines (56 loc) · 1.69 KB
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
<!doctype html>
<html>
<head>
<title>Documents | rowannerd</title>
<style>
body{font-family:sans-serif;background-color:rgb(255,255,200);}
button{color:white;background-color:red;height:50px;}
button:hover{background-color:black;}
</style>
</head>
<body>
<button onclick="start()" id="startbtn">Make a New Document/Retrieve Previous</button>
<div id="doc">
<label>Title: </label><input type="text" id="titlet"><br><br>
<textarea rows="10" cols="40" id="maint"></textarea><br><br>
<button onclick="update()">Update</button>
<i>This will save this document to your computer</i>
</div>
<script>
var title,startbtn,main,doc;
setup();
function setup() {
//Setup Variables
title = document.getElementById("titlet");
startbtn = document.getElementById("startbtn");
main = document.getElementById("maint");
doc = document.getElementById("doc");
doc.style.display="none";
}
function start() {
//Show and Hide
doc.style.display="block";
startbtn.style.display="none";
//Get Previous Document (saved on localStorage):
if (localStorage.getItem("title") !== null) {
title.value = localStorage.getItem("title");
document.title = title.value + " | rowannerd document";
main.value = localStorage.getItem("text");
}
}
function update() {
//Just in case:
title = document.getElementById("titlet");
startbtn = document.getElementById("startbtn");
main = document.getElementById("maint");
doc = document.getElementById("doc");
//Change the title:
//document.title = title.value + " | rowannerd document";
//Put on localStorage (your device):
localStorage.setItem("title", title.value);
document.title = localStorage.getItem("title") + " | rowannerd document";
localStorage.setItem("text", main.value);
}
</script>
</body>
</html>