previous

page 11

next

Maybe you've realised that our program could be used for any quiz by just changing the images directory and pics.js.

I plan to firm up that idea right now. You will have to replace Landmarks by the appropriate word for your quiz.

First, rename the images directory to Landmarks.

Second, change pics.js like this:

g_Landmarks=[
'Big Ben',
...
];

Third, add to globals.css:

var g_dir='Landmarks';
var g_pics=g_Landmarks;
var g_n=g_pics.length;
var g_ind=[];
for (var i=0;i<g_n;i++) g_ind.push(i);
var g_answer_id;
var g_questions=3;
var g_count=0;
var g_used=[];
var g_k=0;

Fourth, in get_pic(), change

el.src='images/'+pic_n+'.jpg';

to

el.src=g_dir+'/'+pic_n+'.jpg';
previous
next