Javascript window.history.go不工作

Javascript window.history.go不工作,javascript,cross-browser,Javascript,Cross Browser,我有一个点击按钮,我想使用javascript后退一步。为此,我使用window.history.go,虽然它在IE7和firefox中运行良好,但在IE6中不起作用,并且用户停留在同一页面上时没有任何变化 我正在将事件附加到LinkButton使用历史记录。返回()使用历史记录。返回()IE6在window.history.go()方面有问题。它适用于以下常规链接: <a href='#' onclick='history.go(-1);'>Back!</a>

我有一个点击按钮,我想使用javascript后退一步。为此,我使用window.history.go,虽然它在IE7和firefox中运行良好,但在IE6中不起作用,并且用户停留在同一页面上时没有任何变化


我正在将事件附加到LinkButton

使用历史记录。返回()

使用历史记录。返回()

IE6在window.history.go()方面有问题。它适用于以下常规链接:

 <a href='#' onclick='history.go(-1);'>Back!</a>

但其他一些是行不通的。你可以试试这个:

 <button onclick='history.go(-1);'>Back!</button>
回来!
但我不确定这是否有效。您还可以显示所有其他浏览器的按钮和IE的链接:

 <button id='backButton' onclick='history.go(-1);'>Back!</button>
 <!--[if IE 6]>
 <script type='text/javascript'> document.getElementById('backButton').style.display = 'none'; </script>
 <a href='#' onclick='history.go(-1);'>Back!</a>
 <![endif]-->
回来!

当然,最好在单独的javascript文件中添加behaviout,而不是在HTML中内联。但是我想你明白了。IE6在window.history.go()上有问题。它适用于以下常规链接:

 <a href='#' onclick='history.go(-1);'>Back!</a>

但其他一些是行不通的。你可以试试这个:

 <button onclick='history.go(-1);'>Back!</button>
回来!
但我不确定这是否有效。您还可以显示所有其他浏览器的按钮和IE的链接:

 <button id='backButton' onclick='history.go(-1);'>Back!</button>
 <!--[if IE 6]>
 <script type='text/javascript'> document.getElementById('backButton').style.display = 'none'; </script>
 <a href='#' onclick='history.go(-1);'>Back!</a>
 <![endif]-->
回来!
当然,最好在单独的javascript文件中添加behaviout,而不是在HTML中内联。但是我想你明白了。

“history.back();return false;“works brilliant thanx for your answere”history.back();return false;“works brilliant thanx for your answere”