0

I have a problem while opening asp.net page. on post back my page scrolling to the middle of the page. Page contains one ModalPopupExtender and so many javascripts. I think the page focusing on this ajax control while page load. There is no javascript function related to "animation" or "scroll" to scroll page.I tried below code to fix

         $(document).ready(function() {
        document.getElementById('staticcontrols').scrollIntoView(false);
          });"

In mozilla FX its working but not in IE. Please help me.

Thanks in advance.

4

2 回答 2

1
    //JQUERY library needed
    //SOURCE
      <script type="text/javascript" src="../Styles/Cjs/jquery-1.6.4.min.js"></script>
      <script type="text/javascript">
      function main() {
                         $('html, body').animate({ scrollTop: 340 }, 'slow');
                      };
      </script> 

    //C#

    page_load
    {
     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>main();</script>", false);
    }

//JQUERY library
https://jquery.com/download/
于 2013-05-15T12:34:53.823 回答
0

试试这个代码

 <script type="text/javascript">
   scroll(0, 0); 
 </script>

当回发发生时,它将在最上角滚动您的页面。

希望它可以帮助你。

于 2013-05-15T12:47:48.237 回答