Create an IFrame Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:IFrame


You can create an <iframe> element by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">create an IFRAME element with in the frame</button>

function myFunction() {//from   w w  w .  j  a v a  2  s  . c om
    var x = document.createElement("IFRAME");
    x.setAttribute("src", "");


Related Tutorials