0
我們創造這樣添加JS來iframe的功能 - 道場
var iframe = dojo.io.iframe.create(generatedRequestId);
一個iFrame我們希望有插入額外的像
功能printThis(){ window.print javascript函數(); }
iFrame中,以便在父窗口我們可以稱之爲printThis從一些代碼()函數一樣
_setPrintExportCookieInterval: function(/**String*/requestId, /**function*/closePopup, /**String*/exportTypeId) {
//have the interval autoexpire after some amount of seconds
var count = 0;
var intervalMs = 2000;
var intervalId = self.setInterval(function() {
var reportCookie = dojo.cookie(requestId);
if(reportCookie || count > 300000) { //5 mins
//if there's a status failure, don't close the window
if(reportCookie == "success") {
//console.debug(exportTypeId);
if(exportTypeId == PRINT) {
var iframe = dojo.byId(requestId);
iframe.printThis();
}
closePopup();
} else {
console.debug("print/export request returned with nonstandard status " + reportCookie);
}
window.clearInterval(intervalId);
//delete the cookie
dojo.cookie(requestId, null, {path: "/", expires: -1});
//destroy the iframe
//dojo.destroy(dojo.byId(requestId));
};
count+=intervalMs;
}, intervalMs);
return intervalId;
},
-is這可能嗎?我知道dojo.io.iframe.create(generatedRequestId)需要第二個參數,這個參數是在onload時執行的代碼 - 但不一定是在iframe加載後可以調用的函數?
感謝您的任何建議。