js如何獲取div的高度?
所屬欄目: 網(wǎng)站開(kāi)發(fā) | 更新時(shí)間:2016-4-2 | 閱讀:3624 次
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號(hào)-1
陜公網(wǎng)安備 61102302611024號(hào)
工商監(jiān)管