window.navigator.Allframes=null;
window.navigator.Allframes = { 'iframe1': window };
//根据页面name属性查找到子页面所在Ifame对象
window.navigator.getFrameByName=function(oName){
return this.Allframes[oName]
};
//将一个Iframe对象注册到window.navigator.Allframes数组中
window.navigator.registerFrame=function(oName,oElement){
this.Allframes[oName]=oElement
};
window.navigator.createFrame = function (childPage) {
var fun = function () {
this.objChildPage = childPage;
this.getFrameByName = function (oName) {
return window.navigator.getFrameByName(oName)
};
this.resizeHeight = function () {
try {
var height = this.objChildPage.document.body.scrollHeight;
if (this.objChildPage.document.getElementById('iframe1').name && height) {
var curIframe = window.navigator.getFrameByName("iframe1");
curIframe.height = height+120;
return document.body.scrollHeight+120;
}
} catch (ex) {
//异常处理
alert(ex);
}
}
};
return new fun();
};
//在body.onload中调用
function AutoResizeHeight(){
try {
var control = window.navigator.createFrame(this);
control.resizeHeight();
}catch(ex){
alert(ex);
}
}
//当iframe onload 的时候
function myAsync() {
AutoResizeHeight(this);
}