previous

page 30

next

Next step is to make sure the new pick is always displayed.
I'm going to write a show_pick function to do this.

function show_pick() {
var pick_image=document.getElementById('pick');
pick_image.src='counters/'+pick+'.png';
}

We'll need to mention this new function in 3 places - can you find them all?

in the head section of index.html
<script src='show_pick.js'></script>
<script src='cell_clicked.js'></script>
near the end of index.html
<script>show_pick();</script>
</body>

Why near the end ? Because we can't put something into the image until after it's been loaded.

and at the end of cell_clicked.js
pick=Random(9);
show_pick();
previous
next