您的位置:首页 > 其它

获取某div的高度,赋值给另一个div

2014-04-17 17:00 603 查看
modkong为赋值对象

简短版

<script type="text/javascript">

window.onload = function() {

document.getElementById("modkong").style.height=document.getElementById("divmid").offsetHeight + "px";

}

</script>

繁复版

<script type="text/javascript">

function $(id){

return document.getElementById(id)

}

function getHeight() {

$("modkong").style.height=$("divmid").offsetHeight + "px";

}

window.onload = function() {

getHeight();

}

</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: