Javascript Folks,
I am relatively new to javascript and am working on a script where I
want to utilizes a couple of iframes and format text in them. I have
run into a problem with getting the following code to work in mozilla.
It seems to work in ie.
Eventually I will be replacing the H1 node with a table until I can get
the H1 node to show up in mozilla there is not much point.
I have tested using both a javascript created iframe and one built in
the html file. In both cases the iframes have an id of something_ifr.
function lblifrBdy(id) {
var ifr = document.getElementById(id+'_ifr');
if (ifr) {
alert ('found1: '+ifr.id+' '+ifr.nodeName);
var ifrDoc = ifr.contentWindow ? ifr.contentWindow.document
: ifr.contentDocument;
var ifrbdy =
ifrDoc.documentElement.getElementsByTagName'body') .item(0);
if (ifrbdy) {
alert ('found ifrbdy: '+ifrbdy.nodeName);
ifrbdy.id = id+'_ifrbdy';
var heading = ifrDoc.createElement("H1");
var heading_text = ifrDoc.createTextNode("Test!");
heading.appendChild(heading_text);
ifrbdy.appendChild(heading);
}
}
}
I have done a number of searches and so far have not come up with a
solution. Any help you can provide would be greatly appreciated.
Thanks,
Greg