<script>
window.onload = function (){
var iframeB = document.getElementById("iframepage");
var iframepage = document.createElement('iframe');
iFrameHeight("load");
//document.body.appendChild(iframepage);
iframeB.appendChild(iframepage);
}
//ifram高度自适应
function iFrameHeight() {
var bodyHeight = 460;
if (/msie/.test(navigator.userAgent.toLowerCase()) || /firefox/.test(navigator.userAgent.toLowerCase())) {
bodyHeight = window.frames["iframepage"].document.body.scrollHeight;
}
else {
bodyHeight = document.getElementById("iframepage").contentWindow.document.documentElement.scrollHeight;
}
document.getElementById("iframepage").height = bodyHeight;
}
</script>
html
<div id="rl">
<iframe id="iframepage" name="iframepage" frameBorder=0 scrolling=no onLoad="iFrameHeight()" width="280" src="<?=site_url($this->config->item("front_end_access_direction")."/cart/cart_calendar_iframe?oneday=".(empty($oneDay)?'':$oneDay))?>"></iframe>
</div>
转载于:https://blog.51cto.com/jyb2014/1600675