Iframe自动增高

var adjustIframe = function (id) { var iframe = document.getElementById(id) var idoc = iframe.contentWindow && iframe.contentWindow.document || iframe.contentDocument; var callback = function () { var iheight = Math.max(idoc.body.scrollHeight, idoc.documentElement.scrollHeight); //取得其高 iframe.style.height = iheight + "px"; } if (iframe.attachEvent) { iframe.attachEvent("onload", callback); } else { iframe.onload = callback } }
posted @ 2011-01-19 18:39  ooyiye  阅读(317)  评论(0编辑  收藏  举报