|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
#1
|
|||
|
|||
|
I am using the following javascript in a site because the testimonials must continue to rotate on a 30 second basis.
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. |
|
#2
|
||||
|
||||
|
Hope this helps:
Code:
<script language="JavaScript">
var seconds=30; /* rotate every 30 seconds */
function rotate()
{
var Quotation=new Array()
// QUOTATIONS
Quotation[0] = 'Content1';
Quotation[1] = 'Content2';
var which = Math.round(Math.random()*(Quotation.length - 1));
document.getElementById('textrotator').innerHTML = Quotation[which];
setTimeout('rotate()',seconds*1000);
}
</script>
<div id="textrotator"><!--Quotations will be displayed here--></div>
<script>
window.onload=rotate;
</script>
__________________
Useful Links: [ FireFox3||HTML Validation||CSS Validation||Hate Tables?||Doctypes||HTML 4.01 Spec||CSS 2.1 Spec||CSS3 Info ] Useless Links: [ FashionStyleBlog||LaFontana||Bamboo Clothing||My Twitter ] |
| The Following User Says Thank You to rangana For This Useful Post: | ||
?foru (09-06-2008) | ||
|
#3
|
|||
|
|||
|
That's perfect rangana! This is now seamless from page to page. Thank you
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|