window.history.back()不起作用。 [英] window.history.back() not working.
本文介绍了window.history.back()不起作用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法让这个工作。我一直在努力多年。请帮帮我。
I cant get this to work. I have been trying for ages. Please help me.
<script>
function goBack() {
window.history.back()
}
</script>
<button onclick="goBack()">Go Back</button>
推荐答案
请看与window.history.back() 不一致:与window.history.back()不一致。
这个
<button type="button" onclick="goBack()">Go Back</button>
可能就是您要找的东西
<浏览器可能会将该按钮解释为提交按钮,
提交表单,从而导致页面刷新。添加type =button
将防止发生这种情况。
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.
这篇关于window.history.back()不起作用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文