Adding iframe and paragraph elements dynamically
Posted
by shivesh
on Stack Overflow
See other posts from Stack Overflow
or by shivesh
Published on 2010-06-05T22:50:36Z
Indexed on
2010/06/05
22:52 UTC
Read the original article
Hit count: 134
JavaScript
|html
I want to add iframe element to the page and then add <p>
element inside that iframe.
I tried this:
var iframe = document.createElement('iframe');
iframe.frameBorder = 1;
iframe.width = "500px";
iframe.height = "250px";
iframe.id = "iframe";
var p = document.createElement('p');
iframe.appendChild(p);
document.getElementById("div").appendChild(iframe); //this is a div that I have in body.
© Stack Overflow or respective owner