I am trying to calculate the calculated div height display:noneusing this function:
function getComputedHeight(theElt){
if(navigator.appName=='Microsoft Internet Explorer'){
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;
}
This is my html
<a href="javascript:;" onclick="showme('<?php echo 'mydiv765_'.$userid[$i];?>')">View</a>
and a function called
function showme(objid)
{
var h=getComputedHeight(objid);
alert(h);
}
The function returns: auto.
Please, how can I fix this? Is there a better way to achieve the same effect?
source
share