mamamiaw
08-03-2008, 01:37 AM
Hi all, Sorry to bother u all, I think i previously post about the quiz script, and i read and research abit here and there,
anyway i manage to write some but found some difficulties,especially about random generator..
I have this several 'set' of question and answer, and i like to view'em random
(e.g: refresh---> What is 1+1=?...with option n aswers, refresh---> What is 1+1=?...with option n aswers, refresh---> What is
1+1=?...with option n aswers, ...etc)
questionarray[0] ='What is 1+1=?.'
answer[0] ='1'
Adistract[0] ='2'
Bdistract[0] ='22'
Cdistract[0] ='11'
Ddistract[0] ='0'
questionarray[1] ='what is the color of the sky?.'
answer[1] ='C'
Adistract[1] ='red'
Bdistract[1] ='yellow'
Cdistract[1] ='blue'
Ddistract[1] ='purple'
questionarray[2] ='cow is =?.'
answer[2] ='D'
Adistract[2] ='Tank'
Bdistract[2] ='President'
Cdistract[2] ='Weapon'
Ddistract[2] ='Animal'
questionarray[3] ='What is 2+2=?.'
answer[3] ='A'
Adistract[3] ='4'
Bdistract[3] ='22'
Cdistract[3] ='11'
Ddistract[3] ='0' .....etc
i know this can be done by
var i = Math.round(6*Math.random());
document.write(stemarray[i]);
but when i use that, i only get the question...i can't randomly view them as 'set' [question,option of answers and the right
answer].
and also if any of master n gurus here have better suggestion, both on the question array and get (viewing method on browser),
i'll be very thankful.
Anyway, thanks in advance.
Best Regards
~M~
anyway i manage to write some but found some difficulties,especially about random generator..
I have this several 'set' of question and answer, and i like to view'em random
(e.g: refresh---> What is 1+1=?...with option n aswers, refresh---> What is 1+1=?...with option n aswers, refresh---> What is
1+1=?...with option n aswers, ...etc)
questionarray[0] ='What is 1+1=?.'
answer[0] ='1'
Adistract[0] ='2'
Bdistract[0] ='22'
Cdistract[0] ='11'
Ddistract[0] ='0'
questionarray[1] ='what is the color of the sky?.'
answer[1] ='C'
Adistract[1] ='red'
Bdistract[1] ='yellow'
Cdistract[1] ='blue'
Ddistract[1] ='purple'
questionarray[2] ='cow is =?.'
answer[2] ='D'
Adistract[2] ='Tank'
Bdistract[2] ='President'
Cdistract[2] ='Weapon'
Ddistract[2] ='Animal'
questionarray[3] ='What is 2+2=?.'
answer[3] ='A'
Adistract[3] ='4'
Bdistract[3] ='22'
Cdistract[3] ='11'
Ddistract[3] ='0' .....etc
i know this can be done by
var i = Math.round(6*Math.random());
document.write(stemarray[i]);
but when i use that, i only get the question...i can't randomly view them as 'set' [question,option of answers and the right
answer].
and also if any of master n gurus here have better suggestion, both on the question array and get (viewing method on browser),
i'll be very thankful.
Anyway, thanks in advance.
Best Regards
~M~