Skip to content

Commit 3fcd833

Browse files
committed
Finished ch13 exercise1
1 parent 41fdce0 commit 3fcd833

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

ch13exercise1.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Chapter 13</title>
5+
<style>
6+
[data-drop-target] {
7+
height: 400px;
8+
width: 200px;
9+
margin: 2px;
10+
background-color: gainsboro;
11+
float: left;
12+
}
13+
.drag-enter {
14+
border: 2px dashed #000;
15+
}
16+
.box {
17+
width: 200px;
18+
height: 200px;
19+
}
20+
.navy {
21+
background-color: navy;
22+
}
23+
.red {
24+
background-color: red;
25+
}
26+
</style>
27+
</head>
28+
<body>
29+
<div data-drop-target="true">
30+
<div id="box1" draggable="true" class="box navy"></div>
31+
<div id="box2" draggable="true" class="box red"></div>
32+
</div>
33+
<div data-drop-target="true"></div>
34+
<script>
35+
var times = localStorage.getItem("number");
36+
window.onload = () => {
37+
if (isNaN(times)) {
38+
times = 1;
39+
localStorage.setItem("number", 1);
40+
} else {
41+
times++;
42+
alert("You visited " + times + " time(s).");
43+
localStorage.number = times;
44+
}
45+
};
46+
</script>
47+
</body>
48+
</html>

0 commit comments

Comments
 (0)