确定 Minheight 并通过 javascript 将其放入。它成功运行两次,但相同的代码在第三次调用中不起作用。这个 (document.getElementById("rightadmin").style.minHeight=wrapHeight+'px';) 不起作用。更令人惊奇的是,如果我将第三个提升到第二个位置,那么它会起作用,然后第三个则不起作用。所以基本上我在第二个之后放置的任何内容都不起作用。
JavaScript:
function height(){
var dheight= ($(document).height());
var wheight= ($(window).height());
if(dheight>wheight){
var wrapHeight= dheight;
}
else {
var wrapHeight=wheight;
}
document.getElementById("iframeArea").style.minHeight=wrapHeight+'px';
document.getElementById("dailySchedule").style.minHeight=wrapHeight+'px';
document.getElementById("rightadmin").style.minHeight=wrapHeight+'px';
}
html:
<body onload="height();">
<!--Start of iframeArea-->
<div class="iframeArea" id="iframeArea">
<div class="btnRight" id="rightadmin">
</div>
<!--End of btnRight-->
</div>
<!--End of iframeArea-->
最佳答案
您确定 dailySchedule
ID 存在吗?如果不是,您的函数将抛出错误并且不会执行最后一行。
关于javascript - document.getElementById();第三次不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9818491/