是否有一个功能,我可以附加作为一个按钮的点击事件,使浏览器回到上一页?
<input name="action" type="submit" value="Cancel"/>
是否有一个功能,我可以附加作为一个按钮的点击事件,使浏览器回到上一页?
<input name="action" type="submit" value="Cancel"/>
当前回答
你只需要调用以下命令:
history.go(-1);
其他回答
访问窗口。历史,然后调用回()
window.history.back()
你可以使用以下方法之一:
History.back()或window.history.back()
你还可以返回N个页面 history.go (1)
history.back()
or
history.go(-1)
把这个放到按钮的点击手柄上。它应该是这样的:
<input name="action" onclick="history.back()" type="submit" value="Cancel"/>
<input name="action" type="submit" value="Cancel" onclick="window.history.back();"/>
每次对我都管用
<a href="javascript:history.go(-1)">
<button type="button">
Back
</button>
</a>