Jump to content

HTML5 JS Quiz help


Thunderfist
 Share

Recommended Posts

Just now, Thunderfist said:

I just of rid of the error! All I did was change the value of i in for (i = 0; i <NUM_QUESTIONS; ++i) from 0 to 1.

That works if your questions are named "q1" through "q11", but then you should change the condition to <= otherwise you will only sum "q1" through "q10"

Link to comment
Share on other sites

2 minutes ago, Jinz said:

That works if your questions are named "q1" through "q11", but then you should change the condition to <= otherwise you will only sum "q1" through "q10"

They are 'q1' through to 'q11'. I still need to get it to send people to a different page when the submit button is pressed.

--EDIT--

I just realized that I probably should do that.

--EDIT--

Just fixed it so it did sum up all 11.

Link to comment
Share on other sites

4 minutes ago, Thunderfist said:

They are 'q1' through to 'q11'. I still need to get it to send people to a different page when the submit button is pressed

Then should set NUM_QUESTIONS to 11 and change < to <=

My last example shows how to send to different pages, the one with index.html, resul1.html, and result2.html. It shows how to use if/else to determine which page to send to. Do like that after the for loop that computes the sum.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...