Log in

View Full Version : Div Dynamic Size



buntyindia
11-17-2007, 03:08 PM
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,

BLiZZaRD
11-17-2007, 05:20 PM
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.



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.