JS返回上一页

 <button  onclick="javascript:history.go(-1);">返回上一页</button>

 <button  onclick="javascript:history.back(-1);">返回上一页</button>

两个方法有所不同,一个保留表单数据,一个不保留数据。

javascript:history.back(-1);方法会返回上一页,所填写的数据会消失。

而javascript:history.go(-1);方法返回上一页,所填写的数据不会消失。

原文地址:https://www.cnblogs.com/Man-Dream-Necessary/p/5486471.html