Help - Search - Members - Calendar
Full Version: Calculating a Score using HTML
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
bsimon
Hi, I'm a beginner with HTML, and have a general question.

Is it possible to calculate a score within HTML based on responses to questions?

For example, let's say I have a questionnaire with ten questions. Each of the questions can be answered 1-10, using a dropdown. At the end of the questionnaire, I'd like the total to be calculated for me, so I'm not having to add it up.

Is this possible? If so, how do I write this into my questionnaire?

Thanks!
pandy
No, it isn't. HMTL is a mere markup language, it can't do calculations. You need a programming language. That could be something server side or JavaScript. JavaScript is the most natural place to start if you are new to all of this. It's good enough if it isn't very important that this works under all circumstances. Users may turn JavaScript off or use a device that isn't JavaScript enabled in the first place. If that small number isn't a problem to you, JavaScript is fine.
bsimon
QUOTE(pandy @ Jan 5 2016, 11:54 AM) *

No, it isn't. HMTL is a mere markup language, it can't do calculations. You need a programming language. That could be something server side or JavaScript. JavaScript is the most natural place to start if you are new to all of this. It's good enough if it isn't very important that this works under all circumstances. Users may turn JavaScript off or use a device that isn't JavaScript enabled in the first place. If that small number isn't a problem to you, JavaScript is fine.



Thanks Pandy! That makes sense, I'll look at Java.
pandy
By all means, but look at JavaScript first. They aren't the same thing, not even related. A common mistake. wink.gif
Sam A
You need to learn some tags on W3schools. On this article you can able to find some calculation related information for HTML which can help in your questionnaire.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.