Results 1 to 2 of 2

Thread: Div Dynamic Size

  1. #1
    Join Date
    Jun 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Div Dynamic Size

    Hi,

    I have a Div of Height:285px used for a scrolling table.

    I want to control the size of div dynamically on the basis of record if the table has 20+ records it show full height of the div (285px) but if it have less record the size of Div decreases acordingly..... like it have 10 records the height reduced to 150px etc..


    Please help how to implement this in both browsers mozilla & IE.


    Regards,
    Last edited by buntyindia; 11-17-2007 at 04:13 PM.

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Probably would use JavaScript for that. Make a JS function and tell it what to do, then call the function after the DIV in question.

    Code:
    function changeheight(){
    
    if(y>255&&f==0){f=1;return;}
    
    if(y<256&&f==1){f=0;return;}
    
    if(f)q=-5;if(!f)q=5;y=y+q;
    
    e=document.getElementById("s");
    
    e.style.width = y + 'py';
    
    t=setTimeout("changeheight();",0);
    
    }
    (untested) And my JS is about as useful as a wingless bird in a marshmallow swamp.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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