iframe高度自适应
来源:百度文库 编辑:神马文学网 时间:2024/04/29 18:56:02
js代码如下:
代码
//iframe高度自适应
function IFrameReSize(iframename) {
var pTar = document.getElementById(iframename);
if (pTar) { //ff
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight) {
pTar.height = pTar.contentDocument.body.offsetHeight;
} //ie
else if (pTar.Document && pTar.Document.body.scrollHeight) {
pTar.height = pTar.Document.body.scrollHeight;
}
}
}
//iframe宽度自适应
function IFrameReSizeWidth(iframename) {
var pTar = document.getElementById(iframename);
if (pTar) { //ff
if (pTar.contentDocument && pTar.contentDocument.body.offsetWidth) {
pTar.width = pTar.contentDocument.body.offsetWidth;
} //ie
else if (pTar.Document && pTar.Document.body.scrollWidth) {
pTar.width = pTar.Document.body.scrollWidth;
}
}
}
使用方法如下:
代码
//iframe高度自适应
function IFrameReSize(iframename) {
var pTar = document.getElementById(iframename);
if (pTar) { //ff
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight) {
pTar.height = pTar.contentDocument.body.offsetHeight;
} //ie
else if (pTar.Document && pTar.Document.body.scrollHeight) {
pTar.height = pTar.Document.body.scrollHeight;
}
}
}
//iframe宽度自适应
function IFrameReSizeWidth(iframename) {
var pTar = document.getElementById(iframename);
if (pTar) { //ff
if (pTar.contentDocument && pTar.contentDocument.body.offsetWidth) {
pTar.width = pTar.contentDocument.body.offsetWidth;
} //ie
else if (pTar.Document && pTar.Document.body.scrollWidth) {
pTar.width = pTar.Document.body.scrollWidth;
}
}
}
使用方法如下:
iframe自适应高度[转]
再谈iframe自适应高度
iframe高度自适应
关于IFRAME 自适应高度的研究
Iframe跨浏览器自适应高度完美解决方案
iframe自适应高度和宽度1
关于IFRAME 自适应高度的研究
关于IFRAME 自适应高度的研究 - 编程岁月
实现iFrame自适应高度,原来很简单!_江恒电子的空间
Iframe自动适应高度
Iframe自动适应高度文章
Iframe自动适应高度5
Iframe自动适应高度文章的问题
用javascript动态调整iframe高度1
iframe
iframe
典型的三行二列居中高度自适应布局
DIV高度自适应及应该注意的问题
典型的三行二列居中高度自适应布局
典型的三行二列居中高度自适应布局 w3cn.org
iframe 去
iframe的用法
iframe的用法总结
iframe HTML元素