Retrieveing ALL head elements in document including iframe
- by Vishal Shah
I'm trying to add style elements to all ALL the head elements in a document, including those in an iframe.
if i use
var heads = document.getElementsByTagName('head');
It just returns the first head element and not the ones in the iframe.
this is the complete code :
var heads = document.getElementsByTagName("head");
var style = document.createElement("style");
style.type = "text/css";
style.appendChild(document.createTextNode(css));
for(var i=0;i<heads.length;i++) heads[i].appendChild(style);
but this doesn't seem to work!
am i doing something wrong here...?