File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments