Dear all,

Firstly thanks for reading this post. I have couple questions n problems to solve, and i believe all the masters and gurus here are kind enough to help me. I am not a programmer, nor that i'm experience with jscript. But i have this task or challenge to create a quiz for my class (i'm a part time teacher).

I have tried it on flash but i'm still finding another solution, which i think is easier, that is jscript.

I believe most of you know or ever heard the "who wants to be a millionaire" quiz. Basically what i'm tryin to create is quite similar to that. The only differences are:

1. There are 8 question before you finally win the game, and on question 5,6,7,8, there're certain prizes if they can answer it correctly (ex. if a contestant answer rightly question number 5, they will win prize A, and may continue to next question, which is question number 6, if he/she failed to answer number 6, he/she only win prize A)

2. Every question (1-8) is considered set, where every set consisted of 8-10 questions where the question on every session/game appears randomly (picked/generated randomly)

3. Every time a contestant wins a prize there will be sound played on.

4. There will be background music played on this quiz.

So is it possible to create those?, if yes can anybody enlighten me here?

Here enclosed the layout picture of what the quiz will appear.

Anyway, again thanks for reading, and thanks in advance for kindly answering.

Best regards

Dani AI

Generated

: this is perfectly doable in pure JavaScript. Break the problem into three small, well-tested pieces — question-management, audio, and kiosk/offline hosting — then wire them together. ’s prompt about “pure JS or web” is important: in-browser JS can run offline, but browsers impose autoplay/security rules and file:// differences, so plan for a start gesture or a packaged app.

Use a question-bank per quiz level and shuffle it up front so questions are unique during a session. Example pattern:

function shuffle(arr) {
  for (let i = arr.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [arr[i], arr[j]] = [arr[j], arr[i]];
  }
  return arr;
}

// banks[level] = [ {id, text, choices:[], answerIndex}, ... ]
function nextQuestion(level) {
  const bank = banks[level];
  if (!bank._shuffled) { shuffle(bank); bank._idx = 0; bank._shuffled = true; }
  return bank._idx < bank.length ? bank[bank._idx++] : null;
}

For audio, preload two Audio objects (background loop + effect) and trigger them from user gesture to avoid autoplay blocks. Reset currentTime before replaying a sound. Use MP3+OGG fallbacks for cross-browser support. See MDN on autoplay policies for details: Autoplay guide.

For reliable offline delivery and consistent behavior, either register a Service Worker to cache assets or package as a kiosk app (Electron/NW.js). A tiny Service Worker registration looks like:

if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js'); }

Notes and cautions: you cannot absolutely prevent physical keyboard/mouse use in a browser — disable key handlers and hide the cursor for a kiosk feel, but for secure test conditions use dedicated hardware or a packaged app. Test on each target machine and preload audio to avoid gaps. For more on making assets available offline see the Service Worker docs: Service Worker API.

Recommended Answers

All 2 Replies

Hi,

Will this quiz be purly in javascript or will it be a webbased game.

Hi,
There will be no ask the audience or phone a friend?
This game will be a Pure javascript , played offline.
The contestant (the student) will only see the screen, they're not allowed to have keyboard or mouse.

Anyway, here i upload the thing that i create...to explain the situation.


As u can see...on the javascript file () , i only manage to create a set....
which are:
stemarray[0] ='Monas adalah singkatan dari:'
answer[0] ='B'
adistract[0] ='Monumen Naskah'
bdistract[0] ='Monumen Nasional'
cdistract[0] ='Museum Nasional'
ddistract[0] ='Museum Naskah'

...all till number 7

But what i want to create are:

for question number 1-3 (which the contestant will win 100 point to Hadiah A), they consist of 75 questions that will be

randomly displayed each time the quiz begin

for question number 4-5 (which the contestant will win 100 point to Hadiah A), they consist of 75 questions that will be

randomly displayed each time the quiz begin

for question number 6 (which the contestant will win 100 point to Hadiah A), they consist of 75 questions that will be randomly

displayed each time the quiz begin

for question number 7 (which the contestant will win 100 point to Hadiah A), they consist of 75 questions that will be randomly

displayed each time the quiz begin

for question number 8 (which the contestant will win 100 point to Hadiah A), they consist of 75 questions that will be randomly

displayed each time the quiz begin

So.....anyone interested to help? ^_^


Thanks in advance...

best regards...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.