Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Resize div

  1. #1
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Resize div

    Hi all,

    I have a document that is created on the fly and have ran into a problem. In IE, the document will scroll all the way down so that you can see all of the info, like it should. In NS7, I get 1 of 2 things:
    1) the document shows with no scrollbars at all.
    2) I get scrollbars but they do not allow me to scroll all of the way to the bottom of the document.

    So, I decided to try to resize the div on the fly. I am using this script to try to do the resize:
    Code:
    <SCRIPT>
    function h(){
    var obj = document.getElementById("Tall");
    sHeight=document.documentElement.scrollHeight
    alert (sHeight);
    sHeight=sHeight+500;
    obj.style.height=sHeight;
    sHeight=document.documentElement.scrollHeight
    alert (sHeight);
    }
    window.onload=h;
    </SCRIPT>
    I use this in an external stylesheet to define everything.
    Code:
    .Text {
    position: relative;
    top: 195px;
    left: 10px;
    width: 500px;
    }
    I threw the alerts in there to keep track of what is going on. In IE, the alerts return the values that I expect them too, and the div gets resized. In NS both alerts return the same value (both will return 511 for example), and the div does not get resized, thus the info I have displaying winds up getting clipped. It doesn't seem to matter how much info is displayed, if it is more than a screen full, it is clipped. I even noticed at one point that I would have needed about another 3 lines, and it was clipped. But, another time, I scrolled down for 2 screens and the rest was clipped (approximately half the data by what I could tell).

    So, does anyone have any idea how to either a) solve the problem of all of the data not showing without using a div that is some outrageously large height or b) get this resize to work so that I can hopefully get all of the info available on the screen.

    Any ideas will be gratefully accepted and tried out! :-)

    Thanks!
    Jim

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ames, IA, USA
    Posts
    373
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think you're going to want to kick yourself when you find out the solution.

    Just change the line

    sHeight=sHeight+500;

    to

    sHeight=sHeight+500+"px";
    Need more emoticons?
    Visit Catman's Private Stock

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Wouldn't overflow: scroll work?
    Shawn

  • #4
    New to the CF scene
    Join Date
    Jun 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You're right.... I do want to kick myself after that. :-)

    Thanks for the info, works great.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •