elviscat
09-30-2008, 12:54 PM
Hi All,
I'm new here, so go gentle :)
I have some javascript controlling a DIV box with a border that is inside a table TD, the javascript gets the TD Height as this is expanding all the way to the bottom, and in turn sets the DIV height. however not in Firefox.
I'm not 100% sure but by looking at the javascript below are there problems with this that are causing the reason it is not working in firefox, and can anyone help me with how to correct this please?
Or if someone has any suggestions of how to do this differently maybe!
You can see the box i'm on about here
http://77.99.9.177/cartridge/ on the left underneath shopping cart with browse by category at the top.
thanks in advance
<script type="text/javascript" charset="utf-8">
function getTDHeight(){
contentTop = getPixelsFromTop(document.getElementById("menuN2"))
contentBottom = getPixelsFromTop(document.getElementById("content_bottom"))
heightOfCell = contentBottom - contentTop;
Newheight = heightOfCell -120
document.getElementsByName("surround")[0].style.height = Newheight;
}
function getPixelsFromTop(obj){
objFromTop = obj.offsetTop;
while(obj.offsetParent!=null) {
objParent = obj.offsetParent;
objFromTop += objParent.offsetTop;
obj = objParent;
}
return objFromTop;
}
</script>
I'm new here, so go gentle :)
I have some javascript controlling a DIV box with a border that is inside a table TD, the javascript gets the TD Height as this is expanding all the way to the bottom, and in turn sets the DIV height. however not in Firefox.
I'm not 100% sure but by looking at the javascript below are there problems with this that are causing the reason it is not working in firefox, and can anyone help me with how to correct this please?
Or if someone has any suggestions of how to do this differently maybe!
You can see the box i'm on about here
http://77.99.9.177/cartridge/ on the left underneath shopping cart with browse by category at the top.
thanks in advance
<script type="text/javascript" charset="utf-8">
function getTDHeight(){
contentTop = getPixelsFromTop(document.getElementById("menuN2"))
contentBottom = getPixelsFromTop(document.getElementById("content_bottom"))
heightOfCell = contentBottom - contentTop;
Newheight = heightOfCell -120
document.getElementsByName("surround")[0].style.height = Newheight;
}
function getPixelsFromTop(obj){
objFromTop = obj.offsetTop;
while(obj.offsetParent!=null) {
objParent = obj.offsetParent;
objFromTop += objParent.offsetTop;
obj = objParent;
}
return objFromTop;
}
</script>