原文网址:https://www.youyong.top/article/1158dfb6ec42
提供两种iframe 的高度自适应 iframe 内容页面的方法
原文网址:https://www.youyong.top/article/1158dfb6ec42
提供两种iframe 的高度自适应 iframe 内容页面的方法
原文网址:https://www.youyong.top/article/1158dfb6ec42
$("#iframe_id").load(function() {
SetWinHeight(this);
});
function SetWinHeight(obj) {
var win = obj;
if (document.getElementById) {
if (win) {
win.height = 300;
if (win.contentDocument && win.contentDocument.body.offsetHeight) {
win.height = win.contentDocument.body.offsetHeight;
} else if (win.Document && win.Document.body.scrollHeight) {
win.height = win.Document.body.scrollHeight;
} else if (win.ownerDocument && win.ownerDocument.body.scrollHeight) {
win.height = win.ownerDocument.body.scrollHeight;
} else {
win.height = '400px';
}
}
}
}
<?php
$height = ceil(@$_GET["para"]);
?>
<script>
parent.parent.document.getElementById("Aiframe_id"").height = <?php echo $height;?>;
</script>
作者声明:本篇文章系本人原创,欢迎分享,但未经许可,谢绝转载。
共 0 条留言