function getheight() {
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)
Sys.ie = ua.match(/msie ([\d.]+)/)[1]
else if (document.getBoxObjectFor)
Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
if (Sys.ie) {
document.getElementById("iframeHtml").height = iframeHtml.document.body.scrollHeight;//IE下
// document.getElementById("iframe1").height ="500px";
}
if (Sys.firefox) {
document.getElementById("iframeHtml").height = iframeHtml.document.documentElement.scrollHeight + 50;//火狐下
}
}
aspx.cs部分代码:
<iframe id=\"iframeHtml\" src=\"../../../tohtml/GuestListIframe.aspx?" + strUrl[1] + "\" runat=\"server\" name=\"iframeHtml\" frameborder=\"0\" width=\"100%\" οnlοad=\"getheight();\" marginwidth=\"0\" scrolling=\"no\" marginheight=\"0\"></iframe>
iframe自适应高度或自增
最新推荐文章于 2019-07-16 23:14:14 发布