修复以下javascript代码包含我的最新任务:
// submit the form in the iframe:
document.getElementsByTagName("iframe")[0].contentWindow.dojo.byId(buttonId).click();
// wait 50msec for result to be loaded:
window.setTimeout(function(){
// get documentId of newly created document from result
var docId = document.getElementsByTagName("iframe")[0].
contentWindow.dojo.byId("documentIdDiv").innerHtml;
// put documentId into the outer form
Ext.getCmp("form").getForm().findField("documentId").setValue(docId);
// submit outer form
Ext.getCmp("form").getForm().submit({
...
});
}, 50);
// TODO: Error if result is not available after 50ms.
我现在必须找到一种方法来在iframe重新加载后执行匿名函数。
我想在iframe上使用body onload,但我不能,因为我必须将它插入到新页面的主体中。
答案 0 :(得分:1)
//function that happens when loaded
function loaded() {
b.innerHTML = 'Call Back Worked';
};
//gets elements and sets them to variables
var b = document.getElementById('callback')
var a = document.getElementById("myframe");
//listens to load event
a.addEventListener("load", loaded());