Commit 60a2e85 1 parent 37591ea commit 60a2e85 Copy full SHA for 60a2e85
File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 28
28
</ div >
29
29
< div id ="bottons ">
30
30
< label for ="auto "> 自动:</ label > < input id ="auto " type ="button " value ="关闭 "/>
31
- < input id ="prev " type ="button " value ="上一张 " style ="margin-left:105px "/>
31
+ < input id ="save " type ="button " value ="保存 "/>
32
+ < input id ="load " type ="button " value ="加载 "/>
33
+ < input id ="prev " type ="button " value ="上一张 " style ="margin-left:50px "/>
32
34
< input id ="next " type ="button " value ="下一张 "/>
33
35
</ div >
34
36
</ div >
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ const count = document.getElementById("count"); // 图片数
7
7
const loading = document . getElementById ( "loading" ) ; // loading效果
8
8
9
9
const auto = document . getElementById ( "auto" ) ; // 自动
10
+ const save = document . getElementById ( "save" ) ; // 保存
11
+ const load = document . getElementById ( "load" ) ; // 加载
10
12
const prev = document . getElementById ( "prev" ) ; // 上一张
11
13
const next = document . getElementById ( "next" ) ; // 下一张
12
14
@@ -57,6 +59,21 @@ let inFocus = false; // 输入框是否获取到了焦点
57
59
}
58
60
} ) ;
59
61
62
+ // “保存” 按钮点击事件
63
+ save . addEventListener ( "click" , function ( ) {
64
+ if ( input . value > 0 ) {
65
+ localStorage . setItem ( "savePid" , input . value ) ;
66
+ }
67
+ } ) ;
68
+ // “加载” 按钮点击事件
69
+ load . addEventListener ( "click" , function ( ) {
70
+ const savePid = localStorage . getItem ( "savePid" ) - 0 ;
71
+ if ( savePid > 0 ) {
72
+ input . value = savePid ;
73
+ doEnter ( savePid , false ) ;
74
+ }
75
+ } ) ;
76
+
60
77
// “上一张” 按钮点击事件
61
78
prev . addEventListener ( "click" , doPrev ) ;
62
79
You can’t perform that action at this time.
0 commit comments