I have a simple problem that I can't solve. I know that you guys might know how to solve it. I'm using an extension of dreamweaver called Coursebuilder. I'm making an online-examination to improve education especially in a far region of Asia where there's poor quality of education in there. Now, I'm making a multiplication choice type of exam with radio buttons in it and when the "check answer" was clicked, the answer will be explained. It is already done, but the problem is the feedback score. I can't make a feedback score... example the examination is 40/100 score it must appear on the screen at once after a click of a certain button. That's my only problem for now. It will be used in CD format and online. what should i do? All I need is to know how will I put a button that once it was clicked the score in the examination will appear. I'm an amateur web designer, I need your help.
radio button a.) answer 1
radio button b.) answer 2
radio button c.) answer 3
(button "check answer")
2. what is blah blah ? ?(question number 2)
radio button a.) answer 1
radio button b.) answer 2
radio button c.) answer 3
(button "check answer")
3.
4.
5.
..... 50.
-----------------------
( CHECK SCORE )
then all questions will be 1-50 so to know the score in the entire examination, there should be a button "SCORE" to click and something will appear in the scren telling you of your score. What should I do? Please instruct me. This is important.
I'm sorry, I assumed you had something in place and it was giving you hiccups... Well your problem is easily solved using a bit of javascript, however, since javascript is a client-side construct, the people taking the quiz would be able to cheat or change their answers. If this is not a big concern for you, then javascript would be the easiest to implement...
I will move your post to the javascript forum so that they can help you over there...
-sage-
__________________ HTML & CSS Forum Moderator
"If you don't know what you think you know, then what do you know." R.I.P. Derrick Thomas #58 1/1/1967 - 2/8/2000
hey sage,
thanks for answering my posts. my problem is i don't use javascript that much. there is no concern in cheating.. that is just a self-examination. they read a book and they should know how much they have learned. All they have to do is not to count all their correct answer, there must be a way to show the score. What is the script to that ?
Although it was for a Quiz with a completely different type of content (a lighthearted survey), I just made a script for that in response to another question. The format should be extremely adaptable to your purposes, the script and the markup are fairly well commented for ease of use. Let me know if you need other features/modifications you cannot figure out for yourself: Quiz
I'm just about finished modding up this script so that it will write its own answers and questions from an array, saving whoever uses it a lot of time. If interested, stay tuned to this space.
This code below is the closest one that can solve my problem:
======================
Code:
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var ans = new Array;
var done = new Array;
var yourAns = new Array;
var explainAnswer = new Array;
var score = 0;
ans[1] = "c";
ans[2] = "b";
ans[3] = "a";
ans[4] = "c";
ans[5] = "b";
explainAnswer[1]="Answer 1 is";
explainAnswer[2]="Answer 2 is";
explainAnswer[3]="Answer 3 is";
explainAnswer[4]="Answer 4 is";
explainAnswer[5]="Answer 5 is";
function Engine(question, answer) {
yourAns[question]=answer;
}
function Score(){
var answerText = "How did you do?\n------------------------------------\n";
for(i=1;i<=5;i++){
answerText=answerText+"\nQuestion :"+i+"\n";
if(ans[i]!=yourAns[i]){
answerText=answerText+"\nThe correct answer was "+ans[i]+"\n"+explainAnswer[i]+"\n";
}
else{
answerText=answerText+" \nCorrect! \n";
score++;
}
}
answerText=answerText+"\n\nYour total score is : "+score+"\n";
//now score the user
answerText=answerText+"\nComment : ";
if(score<=40){
answerText=answerText+"You need to study";
}
if(score>=41 && score <=65){
answerText=answerText+"You did ok, but you could have scored better";
}
if(score>=66 && score <=90){
answerText=answerText+"Your study skills are good, almost perfect";
}
if(score>91){
answerText=answerText+"Your Momma would be proud";
}
alert(answerText);
}
// End -->
</script>
</HEAD>
<BODY>
<DIV ALIGN="LEFT">
<h1>Computer Test</h1>
<b>"How much do you know about computers"</b>
<hr>
<FORM>
<b>1. What is the difference between RAM and ROM?</b><br>
<input type=radio name="q1" value="a" onClick="Engine(1, this.value)">a) There is no difference<br>
<input type=radio name="q1" value="b" onClick="Engine(1, this.value)">b) RAM is volatile and ROM is non-volatile<br>
<input type=radio name="q1" value="c" onClick="Engine(1, this.value)">c) RAM is non-permanent and ROM is permanent<br>
<input type=radio name="q1" value="d" onClick="Engine(1, this.value)">d) RAM loses data when there is no electricity and ROM retains data when there is no electriciy.<p>
<b>2. Question 2 here</b><br>
<input type=radio name="q2" value="a" onClick="Engine(2, this.value)">a) Answer 2a here<br>
<input type=radio name="q2" value="b" onClick="Engine(2, this.value)">b) Answer 2b here<br>
<input type=radio name="q2" value="c" onClick="Engine(2, this.value)">c) Answer 2c here<br>
<input type=radio name="q2" value="d" onClick="Engine(2, this.value)">d) Answer 2d here<p>
<b>3. Question 3 here</b><br>
<input type=radio name="q3" value="a" onClick="Engine(3, this.value)">a) Answer 3a here<br>
<input type=radio name="q3" value="b" onClick="Engine(3, this.value)">b) Answer 3b here<br>
<input type=radio name="q3" value="c" onClick="Engine(3, this.value)">c) Answer 3c here<br>
<input type=radio name="q3" value="d" onClick="Engine(3, this.value)">d) Answer 3d here<p>
<b>4. Question 4 here</b><br>
<input type=radio name="q4" value="a" onClick="Engine(4, this.value)">a) Answer 4a here<br>
<input type=radio name="q4" value="b" onClick="Engine(4, this.value)">b) Answer 4b here<br>
<input type=radio name="q4" value="c" onClick="Engine(4, this.value)">c) Answer 4c here<br>
<input type=radio name="q4" value="d" onClick="Engine(4, this.value)">d) Answer 4d here<p>
<b>5. Question 5 here </b><br>
<input type=radio name="q5" value="a" onClick="Engine(5, this.value)">a) Answer 5a here<br>
<input type=radio name="q5" value="b" onClick="Engine(5, this.value)">b) Answer 5b here<br>
<input type=radio name="q5" value="c" onClick="Engine(5, this.value)">c) Answer 5c here<br>
<input type=radio name="q5" value="d" onClick="Engine(5, this.value)">d) Answer 5d here<p>
<CENTER>
<input type=button onClick="Score()" value="See how you scored!">
</CENTER>
</FORM>
</DIV>
but in my case, i need to explain all incorrect answers why they are incorrect, else they are right. Is there's any possibilty to make each questions to have 2 tries... then they will out of tries? This code is good almost fit and perfect to my 'project', what i need is a code where i can insert an explanation to "each" incorrect answers, comparing each of them to the right answer.. but the right answer always remain the same (for each questions. example in question 1. the correct answer remain the same).
Thanks For this! Everything is perfect except or the explanation to each incorrect answers. Because of this i'm learning a little java scripts.
Please i really need this, i'm running out of time. Don't need to make 2 tries per answer if necessary. All i need is for each radio button selected, once the "check score" was selected if incorrect there i can indicate in the popup massage why he is incorrect. For each questions. Because in my sample here, They only indicate if you are correct and the right answer. Please undrestand... i need it.
Well, I am working on it. I was wondering exactly how this is supposed to work though. I can make it congratulate the user if they are correct. If they are incorrect, what exactly is supposed to happen? Like for:
Question:
What part of the USA is New York State in?
1) Mid-Atlantic Region
2) South
3) Western Coastal Area
If they are right, we say Great, you are right. If they are wrong, does it have to say one thing if they picked South and another thing if they picked #3? Will there be more than one wrong answer? If so, do multiple advisories have to be available, one for each wrong choice or can it just be, for example for the above can it be:
"No, New York State is not in that part of the USA it is in the Mid-Atlantic Region"
?
Now, I just ran the code that you posted, it will never work for 50 questions as you mentioned before, the pop up box will be off the screen, being to large too read. Pop ups of this nature are not scrollable.
You seem like you are in such a hurry, odd you haven't gotten back to me. Anyways, this one will probably suit you, I hope. Normally I wouldn't put this out there without taking the time to clean it up a bit more, however you seem rushed, it works bug free (as far as I can tell) in FF1.0.4 and IE6 (my previous efforts were a bit more backwards compatible), so here you go:
well if you already have a function to detect correct or incorrect answers..
do you have a function that detects correct and incorrect answers already? From what I understand of your problem you do, and all you need is a way to add a button that shows how many are correct?
Well if that's it, make sure you have a count to keep a tally of correct answers. Then somewhere in the html (where you want score to appear) insert something like this:
You can add changes to the syle of the input box to suit your needs widthwise/background color etc.
Then you need a scoreDisplay() javascript function that would contain the value for the number of correct answers. Insert something like this into the HEAD of your html file.
this is too much guys! but i want to say THANK YOU very much! you are a great help. This one can actually do it..... i can use it already for my project... i can say 99% perfect. (The last code, the one with "see details") If possible can it be a 2 trial test for each question? example if they choose 1st incorrect... it will show why it is incorrect. now if they choose 2nd,then after the "check button" was clicked it will show why it is incorrect and he can never try again (for that question) a popup message will appear "Sorry you are out of tries"... if they refresh the page they can try again...that doesn't matter... but each question should be limited to 2 tries... BUT THANKS SO MUCH FOR THIS. that will do.
because of this i'm now interested in learning java scripts.. i hope i can learn more so i can contribute to your forum in the future hehe
OK, I've got the two tries thing down. Actually, it and a lot of the features of this quiz are configurable as documented in the beginning part of the script. I've also upgraded the report so it looks nicer and takes up less screen real estate. I had to institute an onload event for Mozilla based browsers but, since this is or should generally be a stand alone page (not featured as a part of some other complex page except through a frame) that should be no problem. Here is the latest, v.5a2: