previous

page 7

next
Asking multiple questions

The time to ask the next question is after the player has answered the current one. But we'll need to pause before doing that so the player can see the result.

We'll also need to call clear() before displaying the next question.

function get_pic() {
clear();
Shuffle(g_ind);
g_answer_id=Random0(4);
var pic_n=g_ind[g_answer_id];
var el=document.getElementById('pic');
el.src='images/'+pic_n+'.jpg';
for (var i=0;i<5;i++) {
var el=document.getElementById(i);
var pic_n=g_ind[i];
el.textContent=g_pics[pic_n];
}
}
function klick(el) {
var el_answer=document.getElementById(g_answer_id);
el_answer.style.backgroundColor='palegreen';
var id=el.id;
if (id!=g_answer_id) {
el.style.backgroundColor='red';
}
setTimeout(get_pic,3000);
}
previous
next