Guest User

Untitled

a guest
May 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. document.getElementById('myiframe').src = 'http://vimeo.com/videoid1';
  2. document.getElementById('myiframe').src = 'http://vimeo.com/videoid2';
  3. document.getElementById('myiframe').src = 'http://vimeo.com/videoid3';
  4.  
  5. document.getElementById('myiframe').contentWindow.location.replace('http://vimeo.com/videoid1');
  6. document.getElementById('myiframe').contentWindow.location.replace('http://vimeo.com/videoid2');
  7. document.getElementById('myiframe').contentWindow.location.replace('http://vimeo.com/videoid3');
  8.  
  9. <!doctype html>
  10.  
  11. <style>
  12. iframe {
  13. width: 300px;
  14. height:300px;
  15. }
  16. </style>
  17.  
  18. <script>
  19. var urls = ["http://bing.com", "http://google.com", "http://duckduckgo.com"];
  20.  
  21. function next() {
  22. if(urls.length==0) return;
  23. var original = document.getElementsByTagName("iframe")[0];
  24. var newFrame = document.createElement("iframe");
  25. newFrame.src = urls.pop();
  26. var parent = original.parentNode;
  27. parent.replaceChild(newFrame, original);
  28. }
  29. </script>
  30.  
  31. <p>let's test some iframes</p>
  32. <button onclick="next()">next</button>
  33. <iframe />
  34.  
  35. var iframe = $('#iframe')[0];
  36. iframe.contentWindow.location.replace(newUrl);
Add Comment
Please, Sign In to add comment