I am trying to change the text continously for the text inside a table but it stops after reaching the 2nd index in the array. Anyone can debug? Below are the coding:
<script language="javas cript">
var i=0;
var text=["Chocolate" , "Vanilla", "Strawberry "];
function dhtml(){
document.write( "<table border='1' color='black'>" );
document.write( "<tr align='center' bgcolor='grey'> ");
document.write( "<td colspan='300'>" );
document.write( "<font size='10' color='red'><b> ");
// if(i >= 3) {
// i = 0;}
document.write( text[i]);
document.write( "</b></font>");
document.write( "</td>");
document.write( "</table>"); i++;}
setInterval('dh tml()', 1000);
dhtml();
// clearInterval(i d);
</script>
<script language="javas cript">
var i=0;
var text=["Chocolate" , "Vanilla", "Strawberry "];
function dhtml(){
document.write( "<table border='1' color='black'>" );
document.write( "<tr align='center' bgcolor='grey'> ");
document.write( "<td colspan='300'>" );
document.write( "<font size='10' color='red'><b> ");
// if(i >= 3) {
// i = 0;}
document.write( text[i]);
document.write( "</b></font>");
document.write( "</td>");
document.write( "</table>"); i++;}
setInterval('dh tml()', 1000);
dhtml();
// clearInterval(i d);
</script>
Comment