【发布时间】:2023-03-18 22:17:01
【问题描述】:
我无法将任何 onload 函数附加到我动态创建的 iframe 的问题上。这仅在 IE 中发生,在 FF 中有效。这是我的代码:
var ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", "legacy-hostpage.html?rnd=" + new Date().getTime());
ifrm.style.width = "100%";
ifrm.style.height = "400px";
ifrm.name = "legacy-frame";
ifrm.id = "IFRM-" + new Date().getTime();
ifrm.onload = function() {
alert('onload onload');
};
wrapper.appendChild(ifrm);
我希望我可以在这个项目中使用 jQuery,但我不能......你能告诉我有什么问题吗?
【问题讨论】:
标签: html internet-explorer iframe