javascript adding javascript to iframe dynamically

Posted by Sendoh on Stack Overflow See other posts from Stack Overflow or by Sendoh
Published on 2010-06-09T11:31:11Z Indexed on 2010/06/09 11:42 UTC
Read the original article Hit count: 496

Filed under:
|

The code below will add an iframe dynamically, is there a way to insert javascript to this iframe dynamically?

Thx

  var iFrame = document.createElement('iframe');
  var iFrameSRC = "http://www.google.com";
  iFrame.name = 'hehe';
  iFrame.id = 'hehe';
  iFrame.src = iFrameSRC;
  iFrame.width = '1px';
  iFrame.height = '1px';
  iFrame.frameBorder = 0;
  iFrame.style.overflow = "hidden";
  iFrame.style.align = "left";
  iFrame.style.display = "block";
  iFrame.style.fontSize = "10px";

  bodyInner.appendChild(iFrame);

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about iframe