Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed May 13, 2024
1 parent 37591ea commit 60a2e85
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion p/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
</div>
<div id="bottons">
<label for="auto">自动:</label><input id="auto" type="button" value="关闭"/>
<input id="prev" type="button" value="上一张" style="margin-left:105px"/>
<input id="save" type="button" value="保存"/>
<input id="load" type="button" value="加载"/>
<input id="prev" type="button" value="上一张" style="margin-left:50px"/>
<input id="next" type="button" value="下一张"/>
</div>
</div>
Expand Down
17 changes: 17 additions & 0 deletions p/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const count = document.getElementById("count"); // 图片数
const loading = document.getElementById("loading"); // loading效果

const auto = document.getElementById("auto"); // 自动
const save = document.getElementById("save"); // 保存
const load = document.getElementById("load"); // 加载
const prev = document.getElementById("prev"); // 上一张
const next = document.getElementById("next"); // 下一张

Expand Down Expand Up @@ -57,6 +59,21 @@ let inFocus = false; // 输入框是否获取到了焦点
}
});

// “保存” 按钮点击事件
save.addEventListener("click", function () {
if (input.value > 0) {
localStorage.setItem("savePid", input.value);
}
});
// “加载” 按钮点击事件
load.addEventListener("click", function () {
const savePid = localStorage.getItem("savePid") - 0;
if (savePid > 0) {
input.value = savePid;
doEnter(savePid, false);
}
});

// “上一张” 按钮点击事件
prev.addEventListener("click", doPrev);

Expand Down

0 comments on commit 60a2e85

Please sign in to comment.