Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- document.getElementById('myiframe').src = 'http://vimeo.com/videoid1';
- document.getElementById('myiframe').src = 'http://vimeo.com/videoid2';
- document.getElementById('myiframe').src = 'http://vimeo.com/videoid3';
- document.getElementById('myiframe').contentWindow.location.replace('http://vimeo.com/videoid1');
- document.getElementById('myiframe').contentWindow.location.replace('http://vimeo.com/videoid2');
- document.getElementById('myiframe').contentWindow.location.replace('http://vimeo.com/videoid3');
- <!doctype html>
- <style>
- iframe {
- width: 300px;
- height:300px;
- }
- </style>
- <script>
- var urls = ["http://bing.com", "http://google.com", "http://duckduckgo.com"];
- function next() {
- if(urls.length==0) return;
- var original = document.getElementsByTagName("iframe")[0];
- var newFrame = document.createElement("iframe");
- newFrame.src = urls.pop();
- var parent = original.parentNode;
- parent.replaceChild(newFrame, original);
- }
- </script>
- <p>let's test some iframes</p>
- <button onclick="next()">next</button>
- <iframe />
- var iframe = $('#iframe')[0];
- iframe.contentWindow.location.replace(newUrl);
Add Comment
Please, Sign In to add comment