<a href="javascript:history.go(-1);">返回</a> //点击a标签返回上一步
<input type="button" value="返回" onclick="history.go(-1)" /> //点击按钮返回上一步
>设置进入这个页面的时候3秒之后返回上一步,方法一:
<script type="text/javascript">setTimeout("history.go(-1)", 3000); </script>
>设置进入这个页面的时候3秒之后返回上一步,方法二:
<script language=javascript>
function go()
{
window.history.go(-1);
}
setTimeout("go()",3000);
</script>
JS历史回退技巧

本文介绍了使用JavaScript实现页面自动回退的两种方法,包括直接调用history.go(-1)及利用setTimeout延迟执行,适用于前端开发中对用户体验的优化。

被折叠的 条评论
为什么被折叠?



