Add dynamical elements in a Iframe element than i create
Posted
by serloro
on Stack Overflow
See other posts from Stack Overflow
or by serloro
Published on 2010-04-21T10:41:45Z
Indexed on
2010/04/21
10:43 UTC
Read the original article
Hit count: 266
Hi, i have a litle problem if i create a dynamically IFRAME element and i agregate dynamically elements to the new iframe. It works If i do that:
var miiframe=document.getElementById("miiframe"); var myElement=content.document.createElement("LABEL"); myElement.innerHTML="blabla"; miiframe.contentDocument.body.appendChild(myElement);
but if i do that doesn't works:
var miiframe=content.document.createElement("IFRAME");
miiframe.src="about:blank";
document.body.appendChild(miiframe);
var myElement=content.document.createElement("LABEL");
myElement.innerHTML="blabla";
miiframe.contentDocument.body.appendChild(myElement);
i see the iframe but i don't see the label element. The most courious is if before appendElement i do and alert it works!!!
var miiframe=content.document.createElement("IFRAME");
miiframe.src="about:blank";
document.body.appendChild(miiframe);
var myElement=content.document.createElement("LABEL");
myElement.innerHTML="blabla";
alert("now works!!!");
miiframe.contentDocument.body.appendChild(myElement);
With DIV element works but i want do that with IFRAME element!!! Thanks!!
© Stack Overflow or respective owner