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 7185947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:31:41+00:00 2026-05-28T18:31:41+00:00

To scroll down my chat DIV I am using the following code which is

  • 0

To scroll down my chat DIV I am using the following code which is working awesome with Chrome & FF. And estimated to work fine with all rest popular browsers except IE. Can anybody modify the below code or provide me with some other code that does the same work (But should have cross-browser support).

    <style type="text/css">
            #div2
            {
                width:250px;
                height:300px;
                background-color:Aqua;
                padding:10px;
                font-family:Calibri;
                overflow:auto;
            }
        </style>
        <script type="text/javascript">
            window.setInterval(function () {
                abc1();
            }, 10);

            function abc1() {
                var tb1 = document.getElementById('TextBox2');
                var div1 = document.getElementById('div1');
                var div2 = document.getElementById('div2');
                if (tb1.value != div1.clientHeight) {
                    div2.scrollTop = div2.scrollHeight;
                    tb1.value = div1.clientHeight;
                }
            }
        </script>
        <div id="div2">

                <div id="div1" runat="server"></div>
        </div>
<asp:TextBox ID="TextBox2" runat="server" style="visibility:hidden"></asp:TextBox>

Server side code:

while (dr.Read())
{
    String abc1 = dr[1].ToString();
    String abc2 = dr[2].ToString();
    div1.Controls.Add(new LiteralControl(abc1 + ":" + abc2 + "<br />"));
}

Please feel free to use any technology either JavaScript/CSS/Ajax/jQuery/other but how can a scroll bar can behave in the similar manner in all browsers?

Edit 1:

Main issue is IE is not even displaying div1.clientHeight in TextBox2 🙁 Any other way to find height for IE?

  • 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-05-28T18:31:41+00:00Added an answer on May 28, 2026 at 6:31 pm

    My suggestion would be to use jQuery and use its cross browser equivalent for getting the height. i.e. $('#div1').outerHeight() – this will work in IE as well as all other browsers.


    UPDATE – Your code using jQuery

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
    <script type="text/javascript">
        window.setInterval(function () {
            abc1();
        }, 10);
        function abc1() {
            var tb1 = $('#TextBox2');
            var div1 = $('#div1');
            var div2 = $('#div2');
            if (tb1.val() != div1.outerHeight()) {
                div2.scrollTop(div2[0].scrollHeight);
                tb1.val(div1.outerHeight());
            }
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code is working well to scroll down the complete page. But I
I am using this code on a 'down' button to scroll text in an
I scroll down a page using jQuery. For example, With the code below, the
If you scroll down the page in the following URL, the 'share' div will
(Scroll down to bottom of post to find solution.) Got a asp.net page which
The slideDown() applied to a div element does the slide down, but doesn't scroll
I have implemented a chat script which requires an absolutely positioned DIV to be
I'm trying to scroll down and up with buttons. I wrote lot of code
I have a simple function that will scroll down to a div in dojo.
I am currently trying to unhide a DIV and then right after scroll down

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.