I need a scrolling DIV is a to display my dynamic tree in left frame.
In my jsp , Div overflow is set to "auto"
[HTML]<DIV id=divScroller style="overflow:auto;height:200px">
<!-- stuff goes here -->
</DIV
[/HTML]
I'm using beleow function to set the height ..
Expand|Select|Wrap|Line Numbers
- function resizeVerticalDiv(oDiv, oBottomNeighbor) {
- var iMinHeight = 100; //DIV won't get smaller than this
- var iClientHeight = document.body.clientHeight;
- //the browser's viewable area
- // find the absolute top coordinate
- var iAbsoluteYTop = oDiv.offsetTop;
- var oParent = oDiv.offsetParent;
- while (oParent.tagName.toUpperCase()!= "BODY") {
- iAbsoluteYTop += oParent.offsetTop;
- oParent = oParent.offsetParent;
- }
- // find the absolute bottom coordinate
- var iAbsoluteYBottom;
- if (oBottomNeighbor != null) {
- var iNeighborTop = oBottomNeighbor.offsetTop;
- oParent = oBottomNeighbor.offsetParent;
- while (oParent.tagName.toUpperCase()!= "BODY") {
- iNeighborTop += oParent.offsetTop;
- oParent = oParent.offsetParent;
- }
- iAbsoluteYBottom = document.body.scrollHeight - iNeighborTop
- } else {
- iAbsoluteYBottom = 0
- }
- var iNewHeight = document.body.clientHeight - iAbsoluteYTop -
- iAbsoluteYBottom;
- oDiv.style.posHeight = (iNewHeight >= iMinHeight ? iNewHeight :
- iMinHeight);
- }
Calling this fun ction on BODY onLoad and passing my scrolling DIV as the first argument and the ID of the first object below the DIV as the second argument.
This function is not working Firefox. In IE it's working fine.Can anyone please help me to solve this problem??
Thanks,
Geetha.