You need to assign when the function is called. You're actually not doing with the variable x
<script>
let x = 1;
function getFileStr(num) {
return './status' + num + '.html'
}
function backBtn() {
document.getElementById("myFrame").src = getFileStr(++x);
}
function forwardBtn() {
document.getElementById("myFrame").src = getFileStr(--x);
}
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…