Javascript Text Slideshow
I am trying to add text into a div using JavaScript and/or jQuery and then
have that text change to different text every 10 seconds -- so somewhat
like a slideshow of just plain text. Here's my code:
<div id="textslide"><p></p></div>
<script>
var quotes = new Array();
quotes[0] = "quote1";
quotes[1] = "quote2";
quotes[2] = "quote3";
quotes[3] = "quote4";
quotes[4] = "quote5";
var counter = 0;
while (true) {
if (counter > 4) counter = 0;
document.getElementById('textslide').firstChild.innerHTML =
quotes[counter];
counter++;
setTimeout( // not sure what to put here, 500); // Want to delay loop
iteration
}
</script>
No comments:
Post a Comment