比如我在js中取得了body高度的值,如下:
var bodyHeight = document.body.scrollHeight;现在如下标签:
<td height="100">aaa</td>现我要把td高度100用bodyHeight 代替,我该怎么写呢?
试了几种方法,都不行,如:<td height="<script type="text/javascript">document.body.scrollHeight</script>">aaa</td>
等等,都不行,请高人指教!
var bodyHeight = document.body.scrollHeight;现在如下标签:
<td height="100">aaa</td>现我要把td高度100用bodyHeight 代替,我该怎么写呢?
试了几种方法,都不行,如:<td height="<script type="text/javascript">document.body.scrollHeight</script>">aaa</td>
等等,都不行,请高人指教!
window.onload=function(){//要在页面加载后调整尺寸,否则无效,报错
var bodyHeight = document.body.scrollHeight;
document.getElementById("xzy88").style.height = bodyHeight ;
}
</script>
<td id=xzy88>aaa </td>
document.getElementById("id").style.height = bodyHeight;