【发布时间】:2014-06-24 03:51:36
【问题描述】:
我在重定向到 html 页面时遇到问题。我的情况是:
我有两个名为 First.html 和 Second.html 的页面。 Second.html 包含一个返回链接,即上一页。我已经定义了该链接的<b>href=""</b> 属性。我在它的onClick() 事件上调用了一个JavaScript 函数goBack()。在那里,我编写了使用<b>window.location.href</b> 重定向的代码。 Bcoz,我想做如下的事情:
1.当请求来自First.html时,我必须从Second.html回到First.html
2. 当请求来自 Second.html 时,我必须转到同一页面,即 Second.html。 second.html 的 div 内容是使用 JavaScript 动态变化的,但页面是一样的。
我尝试了以下选项:
window.location.hrefdocument.location.hreflocation.hrefwindow.urlwindow.location.replace(url)location.assign(url);
任何帮助将不胜感激。
谢谢
【问题讨论】:
-
太棒了!下一步是什么?
-
那么,你的 JavaScript 和/或 jQuery 在哪里?你被困在哪里了?您希望我们帮助做什么?
标签: javascript jquery html