我想点击某按钮实现后退到上一页面
Response.Write("<script>window.history.go(-2)</script>");使用了上面的代码,但是页面没有后退,go()的参数用了-1,-3,-4都没用
点击浏览器“后退”按钮却后退到上一页面了多谢指教...

解决方案 »

  1.   

    <input type="button" value="后退" onclick="javascript:window.history.go(-1);"/>
      

  2.   


    Response.Write("<script>window.history.back();</script>");这样看看
      

  3.   

    把上个页面的文件名作为参数传过来,然后
     Response.Redirect("FileName");
      

  4.   

    UploadDataQuery.cs:
     
     #region 属性
            private string inspectionId;
            private string masterName;
            private string phoneNo;
            private string mobile;
            private string inspectionDate;        public string InspectionId
            {
                get
                { 
                    return inspectionId;
                }
            }        public string MasterName
            {
                get
                {
                    return masterName;
                }
            }        public string PhoneNo
            {
                get
                {
                    return phoneNo;
                }
            }        public string Mobile
            {
                get
                {
                    return mobile;
                }
            }        public string InspectionDate
            {
                get
                {
                    return inspectionDate;
                }
            }
            #endregion
    int selectIndex = e.NewSelectedIndex;
                    inspectionId = gvData.Rows[selectIndex].Cells[0].Text.Replace("&nbsp;", "");
                    masterName = gvData.Rows[selectIndex].Cells[1].Text.Replace("&nbsp;", "");
                    phoneNo = gvData.Rows[selectIndex].Cells[2].Text.Replace("&nbsp;", "");
                    mobile = gvData.Rows[selectIndex].Cells[3].Text.Replace("&nbsp;", "");
                    inspectionDate = gvData.Rows[selectIndex].Cells[4].Text.Replace("&nbsp;", "");
                    Server.Transfer("UploadDataDetail.aspx");
    这个是跳转
    UploadDataDetail.cs:
    UploadDataQuery uploadDatQuery;
                    uploadDatQuery = (UploadDataQuery)Context.Handler;
                    inspectionId = uploadDatQuery.InspectionId;
                    masterName = uploadDatQuery.MasterName;
                    phone = uploadDatQuery.PhoneNo;
                    mobile = uploadDatQuery.Mobile;
                    inspectionDate = uploadDatQuery.InspectionDate;这个是接收
      

  5.   

    Response.Redirect(Request.UrlReferrer.AbsoluteUri);
      

  6.   

    Server.Transfer("UploadDataDetail.aspx");
    这个Server是
     System.Web.HttpServerUtility
    的实例
      

  7.   

    我这里实验可以回退。
    为什么你的不行呢?
    你试试这个
    Page.ClientScript.RegisterStartupScript(typeof(string),"key","<script>window.history.go(-2)</script>");
      

  8.   

    9楼,我用你的方法,AbsoluteUri以及UrlReferrer显示的都是当前的绝对地址...为什么呢...谢谢...
      

  9.   

    我用别的跳转方式都能返回
    现在用Server.Transfer("UploadDataDetail.aspx");
    就不能返回了,但是点击浏览器的后退键,是可以返回的