您可以通过将scrollHeight与clientHeight进行比较轻松地做到这一点,请尝试以下操作:
<script type="text/javascript">
function GetContainerSize ()
{
var container = document.getElementById ("tempDiv");
var message = "The width of the contents with padding: " + container.scrollWidth + "px.\n";
message += "The height of the contents with padding: " + container.scrollHeight + "px.\n";
alert (message);
}
</script>
有关更多信息,请查看:http ://help.dottoro.com/ljbixkkn.PHP