Create <iframe> element and set src - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:IFrame

Description

Create <iframe> element and set src

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <script>
function my_code(){
   console.log(" working");
}
var iframe = document.createElement("iframe");
iframe.src = "http://java2s.com";
document.body.appendChild(iframe);
iframe.onload=my_code;

      </script>  
   </body>/*from   ww  w. j  ava2  s.c  o m*/
</html>

Related Tutorials