-
Notifications
You must be signed in to change notification settings - Fork 0
/
story_editor.html
46 lines (40 loc) · 1.29 KB
/
story_editor.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
<!doctype html>
<html>
<head>
<title>Story Writer</title>
<script>
function loadStory(){
var storyName = document.getElementById("input_name").value
var storyHTML = localStorage.getItem(storyName)
document.getElementById("story_editor").value = storyHTML
}
function saveStory(){
var storyName = document.getElementById("name_input").value
var storyHTML = document.getElementById("story_editor").value
localStorage.setItem(storyName, storyHTML)
}
function displayStory(){
var storyHTML = document.getElementById("story_editor").value
document.getElementById("story_display").innerHTML = storyHTML
}
</script>
<style>
textarea{
width: 800px;
height: 250px;
background-color: lightyellow;
}
</style>
</head>
<body>
<h1>Story Editor</h1>
Story Name: <input id=name_input></input>
<section>
<button onclick="loadStory()">Find and Edit</button>
<button onclick="saveStory()">Save it</button>
<button onclick="displayStory()">Display It</button>
</section>
<textarea id="story_editor" placeholder="Write a totally awesome story here."></textarea>
<section id="story_display"></section>
</body>
</html>