Javascript examples for DOM HTML Element:IFrame
You can create an <iframe> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">create an IFRAME element with java2s.com in the frame</button> <script> function myFunction() {//from w w w . j a v a 2 s . c om var x = document.createElement("IFRAME"); x.setAttribute("src", "https://www.java2s.com"); document.body.appendChild(x); } </script> </body> </html>