js如何获取div的高度?
所属栏目: 网站开发 | 更新时间:2016-4-2 | 阅读:4159 次
js如何获取div的高度?代码如下:
<script type="text/javascript">
window.onload = function(){alert(document.getElementById("top").offsetHeight);
}
</script>
其中:document.getElementById("top").offsetHeight
意思为获取ID为top的div的高度。
或者使用:
document.getElementById("div1").style.height
意思为获取ID为div1的div的高度。

陕ICP备13005001号-1
陕公网安备 61102302611024号
工商监管