Hi,
I have a function to calculate dynamic height of a div element
This function correctly return height of dynamic div element.
- function getComputedHeight(theElt){
var browserName=navigator.appName;
if (browserName=="Microsoft Internet Explorer"){
var is_ie=true;
} else {
var is_ie=false;
}
if(is_ie){
tmphght = document.getElementById(theElt).offsetHeight;
}
else{
docObj = document.getElementById(theElt);
var tmphght1 = document.defaultView.getComputedStyle(docObj, "").getPropertyValue("height");
tmphght = tmphght1.split('px');
tmphght = tmphght[0];
}
return tmphght;
}
My div element is
- <div id="content_area"></div>
If I wanted to set static height of #content_area, I would have done this
- $(document).ready(function(){
$("#content_area").css("height","600px");
})
But I want to set height returned by getComputedHeight() function along with "px" value. How can I do This?
I tried this
but its not working
- $(document).ready(function(){
$("#content_area").css("height",getComputedHeight('right')px);
});
Thanks
Regards