asp页面中的后退按钮无法使用javascript:window.history.go(-1) [英] Back button in asp page not working with javascript:window.history.go(-1)

查看:159
本文介绍了asp页面中的后退按钮无法使用javascript:window.history.go(-1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3页 - 第1页,第2页和第3页,其中所有三个页面都有以下代码的后退按钮。



< a href =#önclick=window.history.back(-1);>返回< / a> 





我的期望当我从Page1导航到Page2然后导航到Page3时,它应该返回Page3到Page2然后返回到Page1。但是,它在Page3和Page2之间循环。



有什么方法可以解决这个问题吗?

解决方案

< blockquote>试试这个,,, :)





< a href =   onclick =   window.history.go(-1)> back < /   a  >  


HI,



您可以做的最简单的方法是维护一个唯一的ID,并通过会话或查询字符串传递id来导航页面。



例如说我的page1包含is为1,其后是其余页面。当我在第3页时,会话值将为3.因此,在后退按钮上单击只需更改ID即可转到上一页。这是我脑海中最简单的解决方案。



谢谢


hi sankar ....... < br $>


onclick =window.history.go(-1)



这也可能有效但有问题是你的浏览器必须有这个历史记录如果用户直接键入一些url然后就会出现问题



或者你有查询字符串或会话维护最后一页或重定向到特定的页面



问候......:)


I am having 3 pages - Page1, Page2 and Page3 where all three has back button with below code.

<a href="#"  önclick="window.history.back(-1);">back</a>



My expectation is when I navigate from Page1 to Page2 then to Page3, it should come back Page3 to Page2 then to Page1. But, It is looping between Page3 and Page2.

Is there any way to solve this issue?

解决方案

try this,,,:)


<a href="#" onclick="window.history.go(-1)">back</a> 


HI,

The most easiest way that you can do is maintain an unique id and navigate the pages as you want to by passing the id by session or query string.

e.g say my page1 contains the is as 1 and followed by the rest of the pages. When I am in the page 3 then the session value will be 3. So on the back button click just change the id to go to the previous page. this is the simplest solution that is striking in my mind.

Thanks


hi sankar.......

onclick="window.history.go(-1)"

this may also work but there is problem that your browser must have history in this if user type some url directly then there will be a problems

or you have query strings or sessions maintaining last page or redirecting to the particular page

regards...:)


这篇关于asp页面中的后退按钮无法使用javascript:window.history.go(-1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆