previous

page 5

next
the show_result function
function show_result() {
for (var i=0;i<g_result.length;i++) {
var ids=g_result[i];
for (var j=0;j<3;j++) {
var id=ids[j];
var el=document.getElementById(id);
el.style.backgroundColor='pink';
}
}
}
implementing check & show_result
function square_clicked(el) {
el.textContent='X';
var id=el.id;
g_squares[id]=1;
if (check()) show_result();
}

You can now test that it all works. You should be able to end up with every square pink!

previous
next