-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlokalnotlar.html
More file actions
47 lines (42 loc) · 1.26 KB
/
lokalnotlar.html
File metadata and controls
47 lines (42 loc) · 1.26 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
<html>
<head><title>local storage</title>
<style>
html{background-color:#242424}
textarea{border:2px solid black;outline:none;background-color:#333;color:white}
</style>
</head>
<body>
<center>
<textarea autofocus id="user" style="margin-bottom: 4px; width: 90%; height: 400px">
</textarea><br>
<button id="save">Kaydet</button>
<!--<button id="save">Clear</button>--><br><br><br><br><br><br>
<a href="https://stackoverflow.com/questions/7892446/how-to-save-to-localstorage-from-textarea"></a><br>
</center>
<script>
setInterval(function () {document.getElementById("save").click();}, 5000);
</script>
<script type="text/javascript">
//check if "user" is in localStorage
if (localStorage["user"])
{
var user = localStorage["user"] ;
document.getElementById("user").value = user ;
}
else
{
document.getElementById("user").placeholder = "yazın" ;
console.log("user not found in localStorage")
}
//save entered gmail address
document.getElementById("save").addEventListener("click", function ()
{
var user = document.getElementById("user").value ;
//localStorage["user"] = user ;
localStorage.setItem("user", user) ;
alert("Değişiklikler kaydedildi.") ;
console.log("kaydedildi")
} , false);
</script>
</body>
</html>