Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8152289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:39:56+00:00 2026-06-06T15:39:56+00:00

The situation is this: I have a div with overflow auto containing a table.

  • 0

The situation is this:
I have a div with overflow auto containing a table. The page containing this div is ajaxed into a main page. I want a javascript (jquery is fine) method to run on the ajaxed page load that scrolls the div to a certain tr with an id. What’s the best method to do this? I’ve added a small scale example below.

ATTEMPTED

adjusting ajax call to include scrolltoview (url#id) [Result: 404 error object not found]

jquery scrollTop [Result:currently testing. no scrolling occuring]

AJAX Page

<%@ Page Language="C#" Inherits="APTEIT.scrolltest" %>
<script src="Utilities/Javascript/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#divy").scrollTop($("#25").position().top);
    });
</script>

AJAX CS (just to populate the table easily)

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Web.UI.WebControls;

namespace APTEIT
{
    /*Codebehind for import.aspx*/
    public class scrolltest: Page
    {
        public scrolltest()
        {
        }

        protected void Page_Load()
        {
            Response.Write("<div style=\"overflow:auto;border-style:solid;border-width:2px;border-color:Black;height:200px;width:200px;\" id=\"divy\">");
            Response.Write("<table style=\"border-collapse:collapse\"><tr><th>Number</th><th>Thingy</th></tr>");
            for(int i = 0; i < 100; i++)
            {
                Response.Write("<tr id=\"" + i + "\"><td style=\"border-style:solid;border-width:1px;border-color:black;\">" + i + "</td><td style=\"border-style:solid;border-width:1px;border-color:black;\">thingy" + i + "</td></tr>");
            }
            Response.Write("</table></div>");
        }

    }
}

Main Page(ajax method not included. simply fills “divy2” with asynchronous load of ajax page)

<%@ Page Language="C#" %>
<html>
<head>
<script src="Utilities/Javascript/Utilities.js"></script>
<script src="Utilities/Javascript/jquery-1.7.1.min.js"></script>
</head>
<body>
<script type="text/javascript">
    $(document).ready(function () {
        ajax("scrolltest.aspx", "divy2");
    });
</script>
<div id="divy2">

</div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:39:58+00:00Added an answer on June 6, 2026 at 3:39 pm

    You can use .position() to find out the TR‘s position relative to the parent DIV, and then use .scrollTop() to set the DIV scroll bar to the top of the TR element.

    So, you can use something like this:
    $("div").scrollTop($("div tr#id").position().top);​

    I’ve set up an example of it here: http://jsfiddle.net/dvirazulay/7mQmD/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my situation, I have a div which has height:400px and overflow:auto to
I have this situation where on my main page, there are different fields and
i have this situation: if(isset($_POST[sm]) { print <br><div id=\redirect\>success</div>; } in javascript i have:
I have this situation where I want to display a list of Administration objects
I have this situation: There are a login page with a login form (form
I have this situation where i want to call a certain element depended on
I have a situation like this. I need to repeatedly overload the single div
I have this situation: I made 2 div's, both should be at the exact
I have this situation: <div A> <div B> <div C> Div A is a
i have this situation: <div class=cont_picture> <?php echo <a id=\mine_click\ href=\#\ >a test</a>; ?>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.