一、参考来源:http://www.jb51.net/article/15780.htm
二、自己总结:
//获取窗口高度 obj为iframe的id
function SetWinHeight(obj) {
var win = obj;
var h2 = document.documentElement.clientHeight - 200;
if (document.getElementById) {
if (win && !window.opera) {
if (win.contentDocument && win.contentDocument.body.offsetHeight) {
var h1 = win.contentDocument.body.offsetHeight + 20;
win.height = h1 > h2 ? h1 : h2;
}
else if (win.Document && win.Document.body.scrollHeight) {
var h1 = win.Document.body.scrollHeight + 20;
win.height = h1 > h2 ? h1 : h2;
}
}
}
}