Skip to content

Commit

Permalink
添加上一张和下一张的按钮。
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed May 3, 2024
1 parent edb6521 commit b938a61
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions p/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<label for="count" style="margin-left:20px">图片数:</label>
<span id="count">0</span>
</div>
<div>
<input id="prev" type="button" value="上一张"/>
<input id="next" type="button" value="下一张"/>
</div>
<div id="loading" style="display:none">loading...</div>
<div id="imgs"></div>

Expand Down Expand Up @@ -76,6 +80,26 @@
pid.focus();
pid.selectionStart = pid.selectionEnd = pid.value.length;
});
// 上一张
document.getElementById("prev").onclick = function () {
if (pid.value === '') {
pid.focus();
pid.selectionStart = pid.selectionEnd = pid.value.length;
return;
}
pid.value = pid.value - 1;
enter();
};
// 下一张
document.getElementById("next").onclick = function () {
if (pid.value === '') {
pid.focus();
pid.selectionStart = pid.selectionEnd = pid.value.length;
return;
}
pid.value = pid.value - 0 + 1;
enter();
};

function clearPid () {
if (pid.value !== '') {
Expand Down

0 comments on commit b938a61

Please sign in to comment.