This is a read-only archive. No new posts or registrations. Privacy Page Still need help? Ask the volunteers at Geeks to Go, free.
Software

Looping

2 min read

This thread's last reply is from . Advice, software, and links below may be out of date — treat specific steps and download links with caution.

Hey there!

I have come accross a problem in using the following code:

" rel="nofollow noopener noreferrer">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
http://www.w3.org/1999/xhtml">


Addition




The code works fine, but what I am trying to do with this code is make it work as a loop.

What I want is when the user hits enter (answers the question) it will take you to another question (20 questions in total). Then after that, it will display what questions you got wrong and what questions you got right. When I tried to loop it before, it just gave me two questions instead of one and it wouldn't let you know if you were right or wrong. The loop never ended.

Plus, I want to make the text bigger. The text box I can make bigger no problem , but the actual sum I can only make it as big as +6.

Could someone please help me with this?
it's been many years(20+) since i've done any real programming, and never with javascript, so i won't be able to give you any working code but here's a link to the type of loop i'd probably use called a while loop :- http://www.w3schools.com/js/js_loop_while.asp i hope this will be of some help to you until someone else with better knowledge/experience has the time to reply..

:popcorn:
Hi GaryORLFC,

Just like terry1966, I'm no Javascript expert, but the biggest hurdle I see is how to retain the data between questions. If you want to be able to show what has been answered previously there should be a way for you to store the information each time a question is answered. Just to give you an example, I've revised your code a little bit just to get the loop to work properly:

JScript:



Body:


+Compute
x

I have to apologize for mutilating the code you provided but I have never written Javascript before. I'm sure there more efficient ways than the one I came up with :lol:

I used a hidden form field to temporarily store the loop counter () so we can retrieve and increment it each time the user clicks the button to check their answer. Using cookies may be something to look into or better yet server-side scripting.

HTH.

Still having this problem?

This topic is from the What the Tech archive and can't take new replies. Geeks to Go is an active, free help community run by volunteers. Post your question there and a person, not a bot, will work through it with you.

Ask on Geeks to Go →