javascript - Iframe AfterOnLoadLoading Loop shows only first iFrame -
for domload performance im reaching load 2 ytb iframes through loop after onload, works first one, console not throwing errors, target divs 2 <div class="ytb-holder-image"></div>
, missing something?
var srcs= new array(); srcs[0]= "fhihmdpbqdi"; srcs[1]= "omrzp7cp79g"; function createiframe(){ (var j = 0; j < 1; j++) { var = 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 wants load content in similar way here conditions ie:
if (window.addeventlistener) window.addeventlistener("load", createiframe, false); else if (window.attachevent) window.attachevent("onload", createiframe); else window.onload = createiframe;
javascript dom iframe youtube appendchild
No comments:
Post a Comment