PDA

View Full Version : having problems


tane
10-11-2004, 02:08 AM
I am just learning and am trying to create a script that will print out the 8 times table but keep getting a error below is the code i have created


<script language="javascript">
var i,j

for(j=1,i=8;i<97;i+=8;j++)

{
document.write("<br>" + j +" X 8 = " + i);
}


</script>

Horus_Kol
10-11-2004, 02:29 AM
<script type='text/javascript'>

var i;
var j;

for (i = 1; i <= 12; i++)
{
document.write("<br>" + i + " x 8 = " + (i*8));
}

</script>


it's just a bit easier to read, and you don't need that complex for loop...

tane
10-11-2004, 02:33 AM
thankyou