for domload performance im reaching to load my 2 ytb iframes through a loop after Onload, it works for the first one, console is not throwing errors, target divs are the 2 <div class="ytb-holder-image"></div>
, am i missing something?
var srcs= new Array();
srcs[0]= "fhIHMDpbQDI";
srcs[1]= "oMRZp7cp79g";
function createIframe(){
for (var j = 0; j < 1; j++)
{
var i = document.createElement("iframe");
i.src = 'http://www.youtube.com/embed/'+srcs[j];
i.width = "853xp";
i.height = "480px";
document.getElementsByClassName("ytb-holder-image")[j].appendChild(i);
};
}
for documentation, if someone wants to load his content in a similar way here are the conditions for IE:
if (window.addEventListener)
window.addEventListener("load", createIframe, false);
else if (window.attachEvent)
window.attachEvent("onload", createIframe);
else window.onload = createIframe;