Forums
This topic is locked
javascript online quiz help
19 Feb 2005 16:57:49 shola law posted:
Hello good pple of the forum. I 've made a rather sloppy online quiz with js, but the real issue i 've with this quiz is that when a user answers a question he/she can go back to change that previous answer, now i am looking for a way to get round that i.e when a user answer a question, when he/she tries to go back to the question and change, the script would bring out an alert that the question has been answered.This is the original script:
<html>
<head>
<title>quiz</title>
<script>
function showscore()
{
var sum=0,inc=0;second=0,well=0;
if(document.form1.msword[0].checked==true)
{inc=document.form1.msword[0].value;
sum=++inc;
}
if(document.form1.excel[1].checked==true)
{second=document.form1.msword[1].value;
well=++second;
}
if(well+sum==1){
alert(well+sum+" point"}
else{
alert(well+sum+" points"
}
}
</script>
</head>
<body>
<form name="form1">
1.what is msword?<br/>
<input type="radio" name="msword" value=0>a word processor<br/>
<input type="radio" name="msword" value=0>a graphic
<input type=”button” onclick=”showscore();” value=”checkscore”>
</body>
</html>
Thank you for taking a look!!!!!!!!!!!!!
If u think u can u can
Replies
Replied 19 Feb 2005 22:48:19
19 Feb 2005 22:48:19 Chris Charlton replied:
Quick question: <b>Do you <i>need</i> the quizes to be in JS (JavaScript)?</b> If not, I can point you to some server solutions if you let me know what <i>Server Model</i> language you are using as well (PHP, ASP, .NET, JSP, CFML).
~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
Replied 21 Feb 2005 12:49:37
21 Feb 2005 12:49:37 shola law replied:
hello thank you for the options, but what i really need is a code added to my existing code that alerts the quiz taker that he/she has answered that same question that he/she is trying to change when the quiz taker clicks on another option in the question
If u think u can u can
If u think u can u can
Replied 22 Feb 2005 05:51:25
22 Feb 2005 05:51:25 Chris Charlton replied:
Hmm, have you thought of using an <i>Array</i> for the users' answers?
~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
Replied 22 Feb 2005 10:45:23
22 Feb 2005 10:45:23 Vince Baker replied:
I agree with chris, you could use an array to collect the answers and if the user goes back to enter an answer again you can check the length of the array to see if they have already answered that question....
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 26 May 2013 09:36:09
26 May 2013 09:36:09 Hari Das replied:
Why unnecessarily you are putting so much of effort. Just check this link to create an interactive quiz using Google Docs and JavaScript. Your problem, that user can't go back to modify previous answers will also solved. Check it out. The basic idea is if you do not allow user to go back to previous answer then it would be great.