底部有一个提交按钮,每提交一次可是页面又回到了开头
我想实现,提交页面刷新后,让页面的位置还在底部,应该怎么实现

解决方案 »

  1.   

    document.body.scrollBottom=document.body.clientHeight
    js
      

  2.   

    function scrollDiv()
    {
         document.all.pos.value = document.all.scrollTop;
    }
    function OnlineformOnload()
    {
    OnloadForScroll();
    }
    function OnloadForScroll()
    {
    var spos = document.all["pos"].value;
    if(! spos)spos=0;
    document.all.onlinediv.scrollTop=spos;
    }<body  onload="OnlineformOnload();">
      

  3.   

    以下为经验证过的写法,确实没有问题.<script language="javascript">
    function GetCookie (name) 
    {
      var arg = name + "=";
      var alen = arg.length;
      var clen = document.cookie.length;
      var i = 0;
      while (i < clen)
      {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
        {
          return getCookieVal (j);
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) 
        {
          break; 
        }
      }
      return null;
    }function getCookieVal (offset) 
    {
      var endstr = document.cookie.indexOf (";", offset);
      if (endstr == -1)
      endstr = document.cookie.length;
      return unescape(document.cookie.substring(offset, endstr));
    }function SetCookie (name, value) 
    {
      document.cookie = name + "=" + escape (value);
    }
    </script>
    </HEAD><body bgColor="#f1f5f5" leftMargin="0" topMargin="0" rightMargin="0" MS_POSITIONING="FlowLayout" onload="document.body.scrollTop=GetCookie('posy')" onunload="SetCookie('posy',document.body.scrollTop)">
      

  4.   

    也可以用锚定位。。
    <-- Link to an anchor. -->
    <A HREF="#anchor">anchor</A><-- Define an anchor. -->
    <A NAME="anchor">
      

  5.   

    把页面的智能导航打开试试
    在页面文件的代码中加入<%# Page ......   smartNavigation="true" %>
      

  6.   

    Page.SmartNavigation = True 打开智能导航
      

  7.   

    二楼的方法用控件记录
    三楼用cookie记录,
    好方法
      

  8.   

    <%@ Page ......   smartNavigation="true" %>这个是智能导航,效果不错。。但是要在IE5或者以上版本才支持此功能
      

  9.   

    <script language="javascript">
    <!--//底部
    var doc = window.frames["in"].document;
    doc.onreadystatechange= function() {
    if(doc.readyState=="complete")
    doc.body.scrollTop = doc.body.scrollHeight;
    }//刷框架代码var icount=false;
    function ref()
    {
      if(icount)
      {
        window.location="Out_Main.aspx";
      }
      window.setTimeout("ref()",3000);
      icount=true;
    }
    -->
    </script>
      

  10.   

    <%@ Page ......   smartNavigation="true" %>
    ------
    这种方法,在你的页面中,没有用到验证控件的时候,是很好,但如果用到验证控件,会出错.
      

  11.   

    http://www.cnblogs.com/huobazi/archive/2004/09/20/44823.html
      

  12.   


    *.appx
    ..
    ..
    ..<a name='#position'></a>
    ....
    ...---------------------
    *.cs
    .....
       response.write(<script>window.location='#position';</script>");
      

  13.   

    不要使用种:<%@ Page ......   smartNavigation="true" %>
    问题太多了............
      

  14.   

    void Page_Load(Object sender, EventArgs e)
    {
       this.SmartNavigation = true;
    }