I am creating an iFrame via an object instance, when the iFrame loads I need to trigger a method from the original object, and be able to retrieve the content of the iframe back in the object. At the moment "up" apparently does not exist.
function iFrame() {
var Id="1234";
var d = document.createElement('DIV');
d.innerHTML = '<iframe id="'Id+'" name="'+Id+'" onload="up('+Id+');"></iframe>';
document.body.appendChild(d);
obj=this;
var i = document.getElementById(this.frameId);
i.up = (function(obj){obj.iFrameOnload()})(obj);
}
iFrame.prototype.iFrameOnload=function(id) {
d = document.getElementById(id).contentWindow.document;
alert(d.body.innerHTML);
}