umefarooq

create iframe in div for widgets like twitter or facebook

Feb 20th, 2014
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <div id="ad54"></div>
  2.  
  3. window.onload = function(){
  4.  
  5. var link = "http://www.google.com"
  6. var iframe = document.createElement('iframe');
  7. iframe.frameBorder=0;
  8. iframe.width="300px";
  9. iframe.height="250px";
  10. iframe.id="randomid";
  11. iframe.setAttribute("src", link);
  12. document.getElementById("ad54").appendChild(iframe);
  13. }
  14.  
  15. taken from this answer
  16. http://stackoverflow.com/questions/10302109/create-iframe-with-javascript-appending-to-a-div
Advertisement
Add Comment
Please, Sign In to add comment