previous

page 21

next
But wait! There's more!

I want to highlight the current number AND allow the player to change the numbers. That's why I have that onClick number function ready to go!

Before you have a go, perhaps check out mine.

First - showing progress
function numbers() {
for (var i=0;i<5;i++) {
var nbr=document.getElementById(i);
nbr.textContent=g_numbers[i];
nbr.style.backgroundColor='brown';
nbr.style.color='ivory';
}
nbr=document.getElementById(g_j);
nbr.style.backgroundColor='lime';
nbr.style.color='black';
}
one_step();
function one_step() {
...
if (g_i<4) {
numbers();
g_timer=setTimeout(one_step,200);
...
}
Next - changing numbers
function number(ind) {
stop();
g_numbers[ind]++;
if (g_numbers[ind]>5) g_numbers[ind]=1;
numbers();
}
previous
next