近段时间,Insus.NET不断补学习Javascript知识。但在练习写返回上一页的功能时,却遇上一点小问题:

 <script>history.go(-1);</script>  

不管怎样,它就是不返回上一页。

经查资料,原来在asp.net的处理方式已经有所改变。当用户点击按钮时,页已经刷新了。因此我们需要把-1改为-2方可以返回至前一页。

View Code
 protected void ButtonGoBack_Click(object sender, EventArgs e)
    {
        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "this""<script>history.go(-2);</script>");
    }

 

示例运行效果:

aspx页面按钮写返回上一页代码

 

 

相关文章:

  • 2022-12-23
  • 2021-11-09
  • 2021-08-30
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-10-12
相关资源
相似解决方案