create dynamic frameset and frame with javascript -
i've problem dynamic creation of frameset , frame, i'm write these simple script:
function createframe(){ var ahead = document.head; var mainfs = document.createelement('frameset'); mainfs.setattribute("name", "mainframeset"); mainfs.setattribute("id", "mfs"); mainfs.setattribute("cols", "50,*"); ahead.appendchild(mainfs); ( var = 0; < 2; i++) { var ifrm = document.createelement("iframe"); ifrm.setattribute("src", "www.facebook.it"); document.getelementbyid('mfs').appendchild(ifrm); }
and put in head of blank html page, won't work!
any suggestion?
you're appending frameset head of html file, nothing appear. function not working, because it's not closed yet, "}" missing @ last. need add event listener, :
window.addeventlistener("load", createframe, false);
here's jsfiddle link you: try it
Comments
Post a Comment