www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Rate Thread Display Modes
      #1  
    Old 07-18-2005, 11:57 AM
    cmor cmor is offline
    Registered User
     
    Join Date: Jun 2004
    Posts: 16
    .scrollHeight in firefox.

    In reference to another post.. http://www.webdeveloper.com/forum/sh...ad.php?t=73044

    calling scrollHeight in firefox seems to only return the visible height of a div. Is there anyway to calculate the entire height of a div?
    Reply With Quote
      #2  
    Old 07-18-2005, 12:59 PM
    Mr J Mr J is offline
    Registered User
     
    Join Date: Apr 2003
    Location: UK
    Posts: 2,203
    Have you tried offsetHeight
    __________________
    The Silent One

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is one with an idea
    Reply With Quote
      #3  
    Old 07-18-2005, 01:05 PM
    cmor cmor is offline
    Registered User
     
    Join Date: Jun 2004
    Posts: 16
    Yeah, offsetHeight does the same thing.
    Reply With Quote
      #4  
    Old 07-18-2005, 01:37 PM
    Mr J Mr J is offline
    Registered User
     
    Join Date: Apr 2003
    Location: UK
    Posts: 2,203
    Can you post your code?

    Or try the following

    PHP Code:
    <div id="test" style="height:50px;overflow:auto">Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>Hello World<br>
    </
    div>

    <
    script>
    alert(document.getElementById("test").offsetHeight+" "+document.getElementById("test").scrollHeight)
    </script>
    I get 50 and 340 in Firefox
    __________________
    The Silent One

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is one with an idea

    Last edited by Mr J; 07-18-2005 at 01:40 PM.
    Reply With Quote
      #5  
    Old 07-18-2005, 03:58 PM
    cmor cmor is offline
    Registered User
     
    Join Date: Jun 2004
    Posts: 16
    Thanks for the response Mr J. That code works fine fore me as well, but if the 'hello world' text extends past the bottom of the page it 'stops counting' so to speak.

    Here's a simplified version of my code:
    PHP Code:
    <div style="position:absolute; width:484px; left: 30px; top: 135px;" id="maintext">
    <
    p>whole bunch of text that makes it extend down for two or three pages</p></div>

    <
    div style="position:absolute; width:484px; left: 30px; top: 135px;" id="maintexttrans"> </div>

    <
    SCRIPT>
    document.getElementById('maintexttrans').style.height = document.getElementById('maintext').scrollHeight + 'px';
    </SCRIPT>
    .scrollHeight works fine if the div does not extend beyond the bottom of the page, but after that it appears to "stop counting" in firefox.

    Last edited by cmor; 07-19-2005 at 02:43 PM.
    Reply With Quote
      #6  
    Old 07-19-2005, 02:43 PM
    cmor cmor is offline
    Registered User
     
    Join Date: Jun 2004
    Posts: 16
    bump. Thanks for the help thus far..
    Reply With Quote
      #7  
    Old 07-19-2005, 09:26 PM
    cmor cmor is offline
    Registered User
     
    Join Date: Jun 2004
    Posts: 16
    bump again, does anyone have an instance of .ScrollHeight working differentlly in firefox?
    Reply With Quote
      #8  
    Old 07-20-2005, 01:59 PM
    cmor cmor is offline
    Registered User
     
    Join Date: Jun 2004
    Posts: 16
    bump because as of now, I'm not seeing it, and it hasn't fixed itself.
    Reply With Quote
      #9  
    Old 07-20-2005, 02:20 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,828
    Try:
    Code:
    <div style="position:absolute; width:484px; left: 30px; top: 135px; line-height:12px;font-size:10px; font-family:arial; margin:0; padding:0; text-align:left; vertical-align:center" id="maintext">
    Gets pretty darn close when using:
    Code:
    <script type="text/javascript">
    onload=function(){
    alert(document.getElementById('maintext').scrollHeight)
    }
    </script>

    Seems like a CSS issue to me.

    Last edited by Ultimater; 07-20-2005 at 02:23 PM.
    Reply With Quote
      #10  
    Old 07-20-2005, 03:36 PM
    cmor cmor is offline
    Registered User
     
    Join Date: Jun 2004
    Posts: 16
    Thanks for the reply it seems that perhaps the formatting in my text was causing problems. I still do not totally understand why. If I remove all formatting it seems to work, even without the,

    line-height:12px;font-size:10px; font-family:arial;

    added. Back to work on that.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:54 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.