Using the following script: <script type="text/javascript"> var iframe_urls = new Array("iframe1.html", "iframe2.html", "iframe3.html", "iframe4.html", "iframe5.html"); var random_number = parseInt(Math.random() * iframe_urls.length); document.write('<iframe frameborder="0" width="200" height="200" src="' + iframe_urls[random_number] + '">Your browser doesn\'t support iframes.</iframe>'); </script> Instead of "random", how can I incorporate a fade in feature or even having buttons outside the iframe to change the html file within it?
instead of Math.random() just start with the beginning of the Array to the End of array and repeat (if that is waht you are trying to say) var max_num = iframe_urls.length - 1; var min_num = 0; //Increment counter; counter++; then you can do a setInterval and have it every 5 seconds load a new iframed url with iframe_urls[counter]; Hope this helps
I was curious about adding two features: 1. A fade in (or other) effect 2. a button on the main page that onClick refreshes the iframe to a specific url Thoughts?