gpt4 book ai didi

javascript - window.history.back() 不工作。

转载 作者:太空狗 更新时间:2023-10-29 13:58:57 24 4
gpt4 key购买 nike

我无法让它工作。我已经尝试了很长时间。请帮我。

<script>
function goBack() {
window.history.back()
}
</script>

<button onclick="goBack()">Go Back</button>

最佳答案

请看this question: Inconsistency with window.history.back() .

这个

<button type="button" onclick="goBack()">Go Back</button> 

可能是你要找的

As Kevin B suggests

The browser could be interpreting the button as a submit button and submitting the form, thus causing a page refresh. Adding type="button" will prevent that.

关于javascript - window.history.back() 不工作。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25673477/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com