好的,我有一个诊断测验,创建了4个类别的问题(每个类别有5个问题)。我试图弄清楚如何将分数加起来并取决于他们如何在每个类别上得分如何告诉用户他们所属的类别。
所有问题都有相同的4个选项:从不,偶尔,经常,总是。然而,每个可能答案的权重是不同的。从不具有值0,偶尔具有值1,通常值为2且值始终为3.
举一个例子,我们可以说前五个问题属于一个类别(A类),玩家回答从不,经常,经常,永远,永远。他们对该类别的得分为7,如果这是最高类别,则将其显示给玩家。
任何人都知道我会这样做吗?
我的想法是,我需要有一些增量系统,将值添加到作为类别的4个变量中?我不太确定,所以我想这就是我在这里发帖的原因。
<!-- A GAME OF CARDS HOME SCREEN -->
<div id="home" class="content">
<div id="google_translate_element"></div>
<p><font size="32"> A Game of Cards</font>
</p>
<a class="btnStart" href="#">
<img src="cards.jpg" />
</a>
<button id="buttonone" class="myButton" type="button">Start Quiz</button>
</div>
<!-- END OF HOME SCREEN -->
<!-- START OF AVATAR DIV -->
<div id="Avatar" class="panel">
<p><font size="28">Please choose an Avatar</font>
</p>
<div class="content">
<img id="Boy" src="Boydone.png" class="Avatars" onclick="changeImgToBoy(); stay();" />
<img id="Girl" src="Girldone.png" class="Avatars" onclick="changeImgToGirl(); stay2();" />
<button id="buttontwo" class="myButton" align="center" type="button">Next</button>
</div>
</div>
<!-- END OF AVATAR DIV -->
<!-- START OF QUESTION 1 DIV -->
<div id="Question1" class="panel">
<div class="question">
<img id="img1" src="Girldone.png" alt="girlAvatar" />Do you find little interest or pleasure in doing things?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q1">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q1">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q1">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q1">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 1 DIV -->
<!-- START OF QUESTION 2 DIV -->
<div id="Question2" class="panel">
<div class="question">
<img id="img2" src="Girldone.png" alt="girlAvatar" />Have you ever felt you should Cut down on your drinking?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q2">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q2">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q2">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q2">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 2 DIV -->
<!-- START OF QUESTION 3 DIV -->
<div id="Question3" class="panel">
<div class="question">
<img id="img3" src="Girldone.png" alt="girlAvatar" />Do you constantly compare yourself to others?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q3">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q3">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q3">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q3">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 3 DIV -->
<!-- START OF QUESTION 4 DIV -->
<div id="Question4" class="panel">
<div class="question">
<img id="img4" src="Girldone.png" alt="girlAvatar" />If you do well at something, do you tend to put it down to luck, rather than feel pleased with yourself?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q4">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q4">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q4">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q4">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 4 DIV -->
<!-- START OF QUESTION 5 DIV -->
<div id="Question5" class="panel">
<div class="question">
<img id="img5" src="Girldone.png" alt="girlAvatar" />Do you sometimes think what it would be like if you were not around?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q5">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q5">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q5">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q5">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 5 DIV -->
<!-- START OF QUESTION 6 DIV -->
<div id="Question6" class="panel">
<div class="question">
<img id="img6" src="Girldone.png" alt="girlAvatar" />Do you feel that other people tend to dislike you?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q6">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q6">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q6">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q6">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 6 DIV -->
<!-- START OF QUESTION 7 DIV -->
<div id="Question7" class="panel">
<div class="question">
<img id="img7" src="Girldone.png" alt="girlAvatar" />Have people annoyed you by criticizing your drinking?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q7">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q7">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q7">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q7">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 7 DIV -->
<!-- START OF QUESTION 8 DIV -->
<div id="Question8" class="panel">
<div class="question">
<img id="img8" src="Girldone.png" alt="girlAvatar" />Are you having trouble falling or staying asleep, or sleeping too much?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q8">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q8">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q8">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q8">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 8 DIV -->
<!-- START OF QUESTION 9 DIV -->
<div id="Question9" class="panel">
<div class="question">
<img id="img9" src="Girldone.png" alt="girlAvatar" />Have you ever injured yourself or anyone as a result of alcohol consumption?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q9">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q9">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q9">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q9">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 9 DIV -->
<!-- START OF QUESTION 10 DIV -->
<div id="Question10" class="panel">
<div class="question">
<img id="img10" src="Girldone.png" alt="girlAvatar" />Do you feel that your opinion doesn't matter to other people?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q10">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q10">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q10">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q10">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 10 DIV -->
<!-- START OF QUESTION 11 DIV -->
<div id="Question11" class="panel">
<div class="question">
<img id="img11" src="Girldone.png" alt="girlAvatar" />Have you ever cut or done damage to your skin on purpose?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q11">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q11">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q11">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q11">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 11 DIV -->
<!-- START OF QUESTION 12 DIV -->
<div id="Question12" class="panel">
<div class="question">
<img id="img12" src="Girldone.png" alt="girlAvatar" />Do you have any interest in the outside world?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q12">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q12">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q12">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q12">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 12 DIV -->
<!-- START OF QUESTION 13 DIV -->
<div id="Question13" class="panel">
<div class="question">
<img id="img13" src="Girldone.png" alt="girlAvatar" />Are you shy?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q13">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q13">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q13">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q13">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 13 DIV -->
<!-- START OF QUESTION 14 DIV -->
<div id="Question14" class="panel">
<div class="question">
<img id="img14" src="Girldone.png" alt="girlAvatar" />Do you ever get a feeling of hopelessness?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q14">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q14">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q14">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q14">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 14 DIV -->
<!-- START OF QUESTION 15 DIV -->
<div id="Question15" class="panel">
<div class="question">
<img id="img15" src="Girldone.png" alt="girlAvatar" />Have you ever had a drink first thing in the morning to steady your nerves or to get rid of a hangover?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q15">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q15">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q15">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q15">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 15 DIV -->
<!-- START OF QUESTION 16 DIV -->
<div id="Question16" class="panel">
<div class="question">
<img id="img16" src="Girldone.png" alt="girlAvatar" />Do you find yourself feeling tired or having little energy?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q16">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q16">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q16">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q16">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 16 DIV -->
<!-- START OF QUESTION 17 DIV -->
<div id="Question17" class="panel">
<div class="question">
<img id="img17" src="Girldone.png" alt="girlAvatar" />Have you found yourself feeling down, upset, or hopeless for no reason?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q17">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q17">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q17">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q17">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 17 DIV -->
<!-- START OF QUESTION 18 DIV -->
<div id="Question18" class="panel">
<div class="question">
<img id="img18" src="Girldone.png" alt="girlAvatar" />Have you ever felt bad or Guilty about your drinking?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q18">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q18">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q18">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q18">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 18 DIV -->
<!-- START OF QUESTION 19 DIV -->
<div id="Question19" class="panel">
<div class="question">
<img id="img19" src="Girldone.png" alt="girlAvatar" />Do you sometimes feel like no one cares about you?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q19">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q19">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q19">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q19">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Next</button>
</div>
</div>
<!-- END OF QUESTION 19 DIV -->
<!-- START OF QUESTION 20 DIV -->
<div id="Question20" class="panel">
<div class="question">
<img id="img20" src="Girldone.png" alt="girlAvatar" />Have you had a poor appetite or overeating?
</div>
<div class="content">
<ul class="answers">
<li>
<label>
<input data-key="a" type="radio" name="Q20">Never</label>
</li>
<li>
<label>
<input data-key="b" type="radio" name="Q20">Occasionally</label>
</li>
<li>
<label>
<input data-key="c" type="radio" name="Q20">Often</label>
</li>
<li>
<label>
<input data-key="d" type="radio" name="Q20">Always</label>
</li>
</ul>
<button id="buttontwo" class="myButton" type="button">Finish</button>
</div>
</div>
<!-- END OF QUESTION 20 DIV -->