-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
40 lines (33 loc) · 1019 Bytes
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>TL</title>
<link rel="icon" href="./compass.ico">
</head>
<body>
<h1>抓紧时间学习 :) :)</h1>
<button>change</button>
<script>
var myBtn = document.querySelector('button');
var myHeader = document.querySelector('h1');
function setChange() {
var myChange = prompt('come on');
localStorage.setItem('change', myChange);
myHeader.textContent = 'progress of' + myChange;
}
if (!localStorage.getItem('change')) {
setChange();
} else {
var stroedChange = localStorage.getItem('change');
myHeader.textContent = 'progress of ' + stroedChange;
}
myBtn.onclick = function() {
setChange();
}
myBtn
</script>
</body>
</html>