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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -