Tech Support Guy banner

Need help with code

582 Views 2 Replies 3 Participants Last post by  Xsage
Actually this code is giving me all question at one time, but i want one question at a time by onclick next btn..please if anyone can help me

Code:
function DisplayQuestions() {
var Questions = new Array(20);
Questions[0] = "Question #1";
Questions[1] = "Question #2";
Questions[2] = "Question #3";
Questions[3] = "Question #4";
Questions[4] = "Question #5";
Questions[5] = "Question #6";
Questions[6] = "Question #7";
Questions[7] = "Question #8";
Questions[8] = "Question #9";
Questions[9] = "Question #10";
Questions[10] = "Question #11";
Questions[11] = "Question #12";
Questions[12] = "Question #13";
Questions[13] = "Question #14";
Questions[14] = "Question #15";
Questions[15] = "Question #16";
Questions[16] = "Question #17";
Questions[17] = "Question #18";
Questions[18] = "Question #19";
Questions[19] = "Question #20";
var QCount = 0;

while (QCount < 20) {
QNumber = Math.round(20 * Math.random());
if (null != Questions[QNumber]) {
document.write("Question number " + QCount + " = " + Questions[QNumber]);
QCount++;
Questions[QNumber] = null; // Dump this question - it's been displayed
}
}
}
function DisplayQuestions() {
var Questions = new Array(20);
Questions[0] = "Question #1";
Questions[1] = "Question #2";
Questions[2] = "Question #3";
Questions[3] = "Question #4";
Questions[4] = "Question #5";
Questions[5] = "Question #6";
Questions[6] = "Question #7";
Questions[7] = "Question #8";
Questions[8] = "Question #9";
Questions[9] = "Question #10";
Questions[10] = "Question #11";
Questions[11] = "Question #12";
Questions[12] = "Question #13";
Questions[13] = "Question #14";
Questions[14] = "Question #15";
Questions[15] = "Question #16";
Questions[16] = "Question #17";
Questions[17] = "Question #18";
Questions[18] = "Question #19";
Questions[19] = "Question #20";
var QCount = 0;

while (QCount < 20) {
QNumber = Math.round(20 * Math.random());
if (null != Questions[QNumber]) {
alert("Question number " + QCount + " = " + Questions[QNumber]);
QCount++;
Questions[QNumber] = null; // Dump this question - it's been displayed
}
}
}
See less See more
Status
Not open for further replies.
1 - 3 of 3 Posts
When posting code kindly follow the instructions in the sticky post at the top of the forum on how to use code tags and edit your post accordingly:

https://forums.techguy.org/threads/please-read-before-posting.1024965/

Thank you.
You could do something like this:

HTML:
[B][SIZE=15] Testing [/SIZE][/B]

        Next Question
1 - 3 of 3 Posts
Status
Not open for further replies.
Top