awood1021
05-03-2007, 02:17 AM
Hi, I'm currently a student at the International School of Beijing. I'm taking a computer connectivity course and I'm trying to make a personality quiz that is a series of multiple choice questions. Each answer is worth a certain amount of points and at the end all the points are added up and a personality type opens in a new window. Nothing is working though and I really really really need help!!! PLEASE!!! The script is below:
<HTML>
<HEAD>
<TITLE>
Personality Quiz
</TITLE>
<script language="javascript">
var Quest = new Array(10);
//this sets up an array for all of the answers that are given
function populate(){
alert("function populate started");
//this function gives each of the answers 0 points so if someone doesnt answer a question the whole thing will continue to work
for(i=0; i<10; i++){
Quest[i]=0;
}
}
function total(){
alert("function total started");
//this function adds the number of points each answer is worth together
int myScore=0;
for(int i=0, i<10; i++){
myScore=myScore+Quest[i];
}
analyzer (myScore)
}
function analyzer (myScore){
//this function uses the total calculated score to figure out which personality type they are
if(myScore>60){
myContents = "Others see you as someone they should handle with care Youre seen as vain, self centered, and who is extremely dominant. Others may admire you, wishing they could be more like you, but dont always trust you, hesitating to become too deeply involved with you."
}
else if(myScore>50 && myScore<61){
myContents = "Others see you as an exciting, highly volatile, rather impulsive personality; a natural leader, whos quick to make decisions, though not always the right ones. They see you as bold and adventuresome, someone who will try anything once; someone who takes chances and enjoys an adventure. They enjoy being in your company because of the excitement you radiate."
}
else if(myScore>40 && myScore<51){
myContents = "Others see you as fresh, lively, charming, amuzing, practical, and always interesting; someone whos constantly in the center of attention, but sufficiently well balanced not to let it go their head. They also see you as kind, considerate, and understanding; someone who will always cheer them up and help them out."
}
else if(myScore>30 &&myScore<41){
myContents = "Others see you as sensible, cautious, careful and practical. They see you as clever, gifted, or talented, but modest...Not a person who makes friends too quickly or easily, but someone whos extremely loyal to friends you do make and who expect the same loyalty in return. Those who really get to know you realize it takes a lot to shake your trust in yoru friends, but eqally that it takes you a long time to get over it if that trust is ever broken."
}
else if(myScore>20 && myScore<31){
myContents = "Your friends see you as painstaking and fussy. They see you as very cautious, extremely careful, a slow and steay plodder. It would really suprise them if you ever did something impulsively or on the spur of the moment, expecting you to examine everything carefully from every angle and then, usally against it. They think this reaction is caused partly by your careful nature."
}
else if(myScore<21){
myContents = "People think you are shy, nervous, and indecisive, someone who needs looking after, who always wants someone else to make the decisions and who does not want to get involved with anyone or anything. THey see you as a worrier who always sees problems that dont exist. SOme people think you are boring. Only those who know you well know that you are not."
}
myDisplay(myContents)
}
function myDisplay(myContents){
//This function will open a new window and show the results calculated
alert(myContents)
}
function saver(int q, int points)
//this function puts the points that each answer is worth into the array
{
q=q-1;
Quest[q]=points
}
</script>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 24px;
color: #FF0080;
}
.style2 {font-family: Arial, Helvetica, sans-serif}
.style3 {color: #FF0080}
.style5 {color: #00FF00}
.style6 {color: #0080FF}
.style11 {color: #80FFFF}
-->
</style>
</HEAD>
<BODY onLoad="populate()">
<FORM NAME="personalityForm">
<span class="style1">Personality Quiz</span><br>
<br>
<span class="style2"><span class="style3">1. When do you feel your best?</span><br>
<INPUT TYPE="RADIO" NAME="q1" checked onClick="saver(1,2)">
<span class="style6">in the morning<br>
<INPUT TYPE="RADIO" NAME="q1" onClick="saver(1,4)">
during the afternoon & early evening<br>
<INPUT TYPE="RADIO" NAME="q1" onClick="saver(1,6)">
late at night</span><br>
<br>
<span class="style3">2. You usually walk</span><br>
<span class="style6">
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,6)" >
fairly fast, with long steps<br>
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,4)">
fairly fast, with short, quick steps<br>
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,7)">
less fast head up, looking the world in the face<br>
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,2)">
less fast, head down<br>
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,1)">
very slowly<br>
</span><br>
<span class="style3">3.When talking to people you</span><br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,4)">
<span class="style6">stand with your arms folder<br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,2)">
have your hands clasped<br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,5)">
have one or both your hands on your hips<br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,7)">
touch or push the person to whom you are talking<br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,6)">
play with your ear, touch your chin, or smooth
your hair</span><br>
<br>
<span class="style3">4. When relaxing, you sit with</span><br>
<span class="style6">
<INPUT TYPE="RADIO" NAME="q4" onClick="saver(4,4)">
your knees bent with your legs neatly side by side<br>
<INPUT TYPE="RADIO" NAME="q4" onClick="saver(4,6)">
your legs crossed<br>
<INPUT TYPE="RADIO" NAME="q4" onClick="saver(4,2)">
your legs stretched out or straight<br>
<INPUT TYPE="RADIO" NAME="q4" onClick="saver(4,1)">
one leg curled under you</span><br>
<br>
<span class="style3">5. When something really amuses you, you react with</span><br>
<INPUT TYPE="RADIO" NAME="q5" onClick="saver(5,6)">
<span class="style6"> a big, appreciative laugh<br>
<INPUT TYPE="RADIO" NAME="q5" onClick="saver(5,4)">
a laugh, but not a loud one<br>
<INPUT TYPE="RADIO" NAME="q5" onClick="saver(5,3)">
a quiet chuckle<br>
<INPUT TYPE="RADIO" NAME="q5" onClick="saver(5,5)">
a sheepish smile</span><br>
<span class="style5"><br>
<span class="style3">6. When you go to a party or social gathering you</span></span><br>
<span class="style6">
<INPUT TYPE="RADIO" NAME="q6" onClick="saver(6,6)">
make a loud entrance so everyone notices you<br>
<INPUT TYPE="RADIO" NAME="q6" onClick="saver(6,4)">
make a quiet entrance, looking around for someone you know<br>
<INPUT TYPE="RADIO" NAME="q6" onClick="saver(6,2)">
make the quietest entrance, trying to stay unnoticed</span><br>
<span class="style3"><br>
7.You're working very hard, concentrating hard, and you're interrupted. Do you..</span><br>
<INPUT TYPE="RADIO" NAME="q7" onClick="saver(7,6)">
<span class="style6">welcome the break<br>
<INPUT TYPE="RADIO" NAME="q7" onClick="saver(7,2)">
feel extremely irritated<br>
<INPUT TYPE="RADIO" NAME="q7" onClick="saver(7,4)">
vary between these two extremes</span><br>
<br>
<span class="style3">8. Which of the following colors do you like most?</span><br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,6)" >
<span class="style6"> red or orange<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,7)" >
black<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,5)" >
yellow or light blue<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,4)" >
green<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,3)" >
dark blue or purple<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,2)" >
white<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,1)" >
brown or gray</span><br>
<span class="style3"><br>
9. When you are in bed at night, in those last few moments before going to sleep, you lie</span><br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,7)" >
<span class="style6">stretched out on your back<br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,6)" >
stretched out face down on your stomach<br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,4)" >
on your side, slightly curled<br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,2)" >
with your head on one arm<br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,1)" >
with your head under the covers</span><br>
<span class="style3"><br>
10. You often dream that you are</span><br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,4)" >
<span class="style6">falling<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,2)" >
fighting or struggling<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,3)" >
searching for something or somebody<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,5)" >
flying or floating<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,6)" >
you usually have dreamless sleep<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,1)" >
your dreams are always pleasant </span><br>
<br>
<INPUT TYPE="button" NAME="result" Value="Click here to see your result" onClick="total()">
</span>
</FORM>
</BODY>
</HTML>
PLEASE HELP!!! THanks!!
<HTML>
<HEAD>
<TITLE>
Personality Quiz
</TITLE>
<script language="javascript">
var Quest = new Array(10);
//this sets up an array for all of the answers that are given
function populate(){
alert("function populate started");
//this function gives each of the answers 0 points so if someone doesnt answer a question the whole thing will continue to work
for(i=0; i<10; i++){
Quest[i]=0;
}
}
function total(){
alert("function total started");
//this function adds the number of points each answer is worth together
int myScore=0;
for(int i=0, i<10; i++){
myScore=myScore+Quest[i];
}
analyzer (myScore)
}
function analyzer (myScore){
//this function uses the total calculated score to figure out which personality type they are
if(myScore>60){
myContents = "Others see you as someone they should handle with care Youre seen as vain, self centered, and who is extremely dominant. Others may admire you, wishing they could be more like you, but dont always trust you, hesitating to become too deeply involved with you."
}
else if(myScore>50 && myScore<61){
myContents = "Others see you as an exciting, highly volatile, rather impulsive personality; a natural leader, whos quick to make decisions, though not always the right ones. They see you as bold and adventuresome, someone who will try anything once; someone who takes chances and enjoys an adventure. They enjoy being in your company because of the excitement you radiate."
}
else if(myScore>40 && myScore<51){
myContents = "Others see you as fresh, lively, charming, amuzing, practical, and always interesting; someone whos constantly in the center of attention, but sufficiently well balanced not to let it go their head. They also see you as kind, considerate, and understanding; someone who will always cheer them up and help them out."
}
else if(myScore>30 &&myScore<41){
myContents = "Others see you as sensible, cautious, careful and practical. They see you as clever, gifted, or talented, but modest...Not a person who makes friends too quickly or easily, but someone whos extremely loyal to friends you do make and who expect the same loyalty in return. Those who really get to know you realize it takes a lot to shake your trust in yoru friends, but eqally that it takes you a long time to get over it if that trust is ever broken."
}
else if(myScore>20 && myScore<31){
myContents = "Your friends see you as painstaking and fussy. They see you as very cautious, extremely careful, a slow and steay plodder. It would really suprise them if you ever did something impulsively or on the spur of the moment, expecting you to examine everything carefully from every angle and then, usally against it. They think this reaction is caused partly by your careful nature."
}
else if(myScore<21){
myContents = "People think you are shy, nervous, and indecisive, someone who needs looking after, who always wants someone else to make the decisions and who does not want to get involved with anyone or anything. THey see you as a worrier who always sees problems that dont exist. SOme people think you are boring. Only those who know you well know that you are not."
}
myDisplay(myContents)
}
function myDisplay(myContents){
//This function will open a new window and show the results calculated
alert(myContents)
}
function saver(int q, int points)
//this function puts the points that each answer is worth into the array
{
q=q-1;
Quest[q]=points
}
</script>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 24px;
color: #FF0080;
}
.style2 {font-family: Arial, Helvetica, sans-serif}
.style3 {color: #FF0080}
.style5 {color: #00FF00}
.style6 {color: #0080FF}
.style11 {color: #80FFFF}
-->
</style>
</HEAD>
<BODY onLoad="populate()">
<FORM NAME="personalityForm">
<span class="style1">Personality Quiz</span><br>
<br>
<span class="style2"><span class="style3">1. When do you feel your best?</span><br>
<INPUT TYPE="RADIO" NAME="q1" checked onClick="saver(1,2)">
<span class="style6">in the morning<br>
<INPUT TYPE="RADIO" NAME="q1" onClick="saver(1,4)">
during the afternoon & early evening<br>
<INPUT TYPE="RADIO" NAME="q1" onClick="saver(1,6)">
late at night</span><br>
<br>
<span class="style3">2. You usually walk</span><br>
<span class="style6">
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,6)" >
fairly fast, with long steps<br>
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,4)">
fairly fast, with short, quick steps<br>
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,7)">
less fast head up, looking the world in the face<br>
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,2)">
less fast, head down<br>
<INPUT TYPE="RADIO" NAME="q2" onClick="saver(2,1)">
very slowly<br>
</span><br>
<span class="style3">3.When talking to people you</span><br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,4)">
<span class="style6">stand with your arms folder<br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,2)">
have your hands clasped<br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,5)">
have one or both your hands on your hips<br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,7)">
touch or push the person to whom you are talking<br>
<INPUT TYPE="RADIO" NAME="q3" onClick="saver(3,6)">
play with your ear, touch your chin, or smooth
your hair</span><br>
<br>
<span class="style3">4. When relaxing, you sit with</span><br>
<span class="style6">
<INPUT TYPE="RADIO" NAME="q4" onClick="saver(4,4)">
your knees bent with your legs neatly side by side<br>
<INPUT TYPE="RADIO" NAME="q4" onClick="saver(4,6)">
your legs crossed<br>
<INPUT TYPE="RADIO" NAME="q4" onClick="saver(4,2)">
your legs stretched out or straight<br>
<INPUT TYPE="RADIO" NAME="q4" onClick="saver(4,1)">
one leg curled under you</span><br>
<br>
<span class="style3">5. When something really amuses you, you react with</span><br>
<INPUT TYPE="RADIO" NAME="q5" onClick="saver(5,6)">
<span class="style6"> a big, appreciative laugh<br>
<INPUT TYPE="RADIO" NAME="q5" onClick="saver(5,4)">
a laugh, but not a loud one<br>
<INPUT TYPE="RADIO" NAME="q5" onClick="saver(5,3)">
a quiet chuckle<br>
<INPUT TYPE="RADIO" NAME="q5" onClick="saver(5,5)">
a sheepish smile</span><br>
<span class="style5"><br>
<span class="style3">6. When you go to a party or social gathering you</span></span><br>
<span class="style6">
<INPUT TYPE="RADIO" NAME="q6" onClick="saver(6,6)">
make a loud entrance so everyone notices you<br>
<INPUT TYPE="RADIO" NAME="q6" onClick="saver(6,4)">
make a quiet entrance, looking around for someone you know<br>
<INPUT TYPE="RADIO" NAME="q6" onClick="saver(6,2)">
make the quietest entrance, trying to stay unnoticed</span><br>
<span class="style3"><br>
7.You're working very hard, concentrating hard, and you're interrupted. Do you..</span><br>
<INPUT TYPE="RADIO" NAME="q7" onClick="saver(7,6)">
<span class="style6">welcome the break<br>
<INPUT TYPE="RADIO" NAME="q7" onClick="saver(7,2)">
feel extremely irritated<br>
<INPUT TYPE="RADIO" NAME="q7" onClick="saver(7,4)">
vary between these two extremes</span><br>
<br>
<span class="style3">8. Which of the following colors do you like most?</span><br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,6)" >
<span class="style6"> red or orange<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,7)" >
black<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,5)" >
yellow or light blue<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,4)" >
green<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,3)" >
dark blue or purple<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,2)" >
white<br>
<INPUT TYPE="RADIO" NAME="q8" onClick="saver(8,1)" >
brown or gray</span><br>
<span class="style3"><br>
9. When you are in bed at night, in those last few moments before going to sleep, you lie</span><br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,7)" >
<span class="style6">stretched out on your back<br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,6)" >
stretched out face down on your stomach<br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,4)" >
on your side, slightly curled<br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,2)" >
with your head on one arm<br>
<INPUT TYPE="RADIO" NAME="q9" onClick="saver(9,1)" >
with your head under the covers</span><br>
<span class="style3"><br>
10. You often dream that you are</span><br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,4)" >
<span class="style6">falling<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,2)" >
fighting or struggling<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,3)" >
searching for something or somebody<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,5)" >
flying or floating<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,6)" >
you usually have dreamless sleep<br>
<INPUT TYPE="RADIO" NAME="q10" onClick="saver(10,1)" >
your dreams are always pleasant </span><br>
<br>
<INPUT TYPE="button" NAME="result" Value="Click here to see your result" onClick="total()">
</span>
</FORM>
</BODY>
</HTML>
PLEASE HELP!!! THanks!!