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

apache - setting document root in antoher partition on ubuntu -

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

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -