hello people, i am new here and have some experience with javascrip. anyways i was wondering if there is a way to make some sort of [I]sleep()
Here is my html code with the javascript, (without such function)
[code=html]
<html>
<head>
<style>
.cell{width:5;height:5;background-color:buttonface}
.green{width:5;height:5;background-color:00ff00}
.mainTable{background-color:black;}
</style>
</head>
<body>
<script>
var x=20
var y=20
writeThis=”<table class=’mainTable’ cellpadding=0 cellspacing=0>”
for(cnt1=0;cnt1<x;cnt1++)
{
writeThis+=”n<tr>”;
for(cnt2=0;cnt2<y;cnt2++)
{
writeThis+=”n<td id=”cor”+cnt1+”x”+cnt2+”” class=”cell” onmouseover=”this.className=’green'”></td>”;
}
writeThis+=”n</tr>”;
}
writeThis+=”n</table>”;
document.write(writeThis);
//document.write(“<textarea cols=’100′ rows=’20’>”+writeThis+”</textarea>”);//remove comment here to see what the for outputs
//up to this point the script works perfectly.
</script>
<script>
for(cnt11=0;cnt11<x;cnt11++)
{
for(cnt22=0;cnt22<y;cnt22++)
{
var nextCell=document.getElementById(“cor”+cnt11+”x”+cnt22);
nextCell.className=’green’;
//i need to add some sort of sleep(1000) to make a pause within the for loop
}
}
</script>
</body>
</html>
I am trying to make a effect where i could make every cell in the table to change color one by one every second or so.
thanks in advance.