IE FF 兼容的IFRAME 自适应高度JS代码
2011-02-23 14:07
351 查看
function SetCwinHeight() {
var iframeid = document.getElementById("EnterpriseCard"); //iframe id
if (document.getElementById) {
if (iframeid && !window.opera) {
if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight) {
jQuery("#EnterpriseCard").css({ "height": iframeid.contentDocument.body.offsetHeight+20 });
iframeid.allowTransparency = "true";
alert(iframeid.contentDocument.body.offsetHeight);
} else if (iframeid.Document && iframeid.Document.body.scrollHeight) {
jQuery("#EnterpriseCard").css({ "height": iframeid.contentDocument.body.offsetHeight + 20 });
iframeid.allowTransparency = "true";
}
}
}
}
如果IFRAME的SRC变化可以用
jQuery().ready(function () {
jQuery("#EnterpriseCard").load(function () {
SetCwinHeight();
});
});
var iframeid = document.getElementById("EnterpriseCard"); //iframe id
if (document.getElementById) {
if (iframeid && !window.opera) {
if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight) {
jQuery("#EnterpriseCard").css({ "height": iframeid.contentDocument.body.offsetHeight+20 });
iframeid.allowTransparency = "true";
alert(iframeid.contentDocument.body.offsetHeight);
} else if (iframeid.Document && iframeid.Document.body.scrollHeight) {
jQuery("#EnterpriseCard").css({ "height": iframeid.contentDocument.body.offsetHeight + 20 });
iframeid.allowTransparency = "true";
}
}
}
}
如果IFRAME的SRC变化可以用
jQuery().ready(function () {
jQuery("#EnterpriseCard").load(function () {
SetCwinHeight();
});
});
相关文章推荐
- 跨域iframe高度自适应(兼容IE/FF/OP/Chrome)
- JQuery IFrame框架高度自适应(支持嵌套–兼容IE,ff,safafi,chrome)
- 跨域iframe高度自适应(兼容IE/FF/OP/Chrome)
- 同域及跨域下iframe高度自适应(兼容IE/FF/OP/Chrome)
- 真正的iframe高度自适应(兼容IE,FF,Opera)
- iframe高度自适应,兼容IE,FF
- 跨域iframe高度自适应(兼容IE/FF/OP/Chrome)
- 跨域iframe高度自适应(兼容IE/FF/OP/Chrome)
- 跨域iframe高度自适应(兼容IE/FF/OP/Chrome)
- 跨域iframe高度自适应(兼容IE/FF/OP/Chrome)
- js实现的真正的iframe高度自适应(兼容IE,FF,Opera)
- 跨域iframe高度自适应(兼容IE/FF/OP/Chrome)
- 【转】真正的iframe高度自适应(兼容IE,FF,Opera)
- js实现的非跨域的iframe高度自适应(完美兼容IE,FF,Opera)
- 跨域iframe高度自适应(兼容IE/FF/OP/Chrome)
- 为何firefox不支持insertRow和insertCell。我如何能让firefox显示和ie显示的效果一样?iframe实现高度自适应,兼容FF、Opera、Safari
- JQuery IFrame框架高度自适应(支持嵌套–兼容IE,ff,safafi,chrome)
- iframe页面调用高度自适应方法代码,兼容IE,FF
- iframe高度自适应,兼容IE,FF