<!DOCTYPE html>
<html>
<body>

<p>Click the button to create an IFRAME element with w3schools.com in the frame.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    var x = document.createElement("IFRAME");
    x.setAttribute("src", "http://www.w3ii.com");
    document.body.appendChild(x);
}
</script>

</body>
</html>