I am using the following javascript in a site because the testimonials must continue to rotate on a 30 second basis.
The above works just fine, but the issue is that it takes 30 seconds for the first testimonial to appear. This is being used dynamically in the header of the site so for that first 30 secs it looks a little blank.Code:<script language="JavaScript"> var seconds=30; /* rotate every 30 seconds */ function rotate() { var Quotation=new Array() // QUOTATIONS Quotation[0] = ''; Quotation[1] = ''; so on.. var which = Math.round(Math.random()*(Quotation.length - 1)); document.getElementById('textrotator').innerHTML = Quotation[which]; } function start() { setInterval("rotate()",seconds*1000); } </script> <div id="textrotator"><!--Quotations will be displayed here--></div> <script> window.onload=start; </script>
I know more about php than javascript, so someone might know a nifty work around to solve that because the code serves it's purpose other than that.
Thank you for any suggestions.



Reply With Quote

Bookmarks