• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

Building an Exam page - over and over and over - easier?

I am making series of web pages that will consist of one page with a multiple-choice question and three possible answers, and a corresponding page containing the correct answer, along with an explanatory paragraph.  Clicking on any of the answers would take you to the answer page for the question.  There will be a total of 300 question pages, with 300 corresponding answer explanation pages.  Is there any way I can make a template that I can easily copy/paste the questions and answers into in order to simplify creating these 600 pages?  The pages themselves will be very simple text with no graphics.

I would like the question page to appear something like this example:
________________________________
Spanish Trivia

Question # 1

The rain in Spain falls mainly on the:
A) Mountain
B) Plain
C) City

Last updated: 4/4/2004
________________________________

And I would like each answer page to appear something like this example:
________________________________
Spanish Trivia

Answer to Question # 1:

The rain in Spain falls mainly on the: (B) Plain.
The correct quote for question # 1 is "The rain in Spain falls mainly on the Plain."

Click HERE for Question #2

Last updated: 4/4/2004
________________________________
0
Steve3k
Asked:
Steve3k
  • 3
  • 3
  • 2
  • +1
1 Solution
 
COBOLdinosaurCommented:
It sound like you need some kind of page creation wizard.  This should get you started.

<html>
<head>
<title> Template Wizard by Cd& </title>
<script type="text/javascript">
<!--
txt=new Array();
txt[0]='<html><head><title>';
txt[1]='</title></head><body>';
txt[2]='<hr /> <form action="';
txt[3]='">';
txt[4]='<input type="radio" onclick="this.form.submit()">';
txt[5]='</form>';
txt[6]='Last Updated: ';
txt[7]='<hr /></body></html>';
function formatdate()
{
   thedate=new Date();
   mon=thedate.getMonth()+1;
   dtstring=mon+'/'+thedate.getDate()+'/'+thedate.getYear();
   return dtstring;
}
function generateQ()
{
   frm=document.forms[0];
   str=txt[0]+frm.ttl.value+txt[1]+txt[2]+frm.anspage.value+txt[3];
   str+=frm.ttl.value+'<br /><br />Question #'+frm.Qnum.value+'<br /><br />';
   str+=frm.Qtxt.value+'<br />';
   for (i=0;i<parseInt(frm.optcnt.value);i++)
   {
      x='opttxt'+i;
      if (!frm.elements[x].disabled)
      str+=txt[4]+frm.elements[x].value+'<br />';
   }
   str+='<br />'+txt[5]+txt[6]+formatdate()+txt[7];
   return str;
}
function generateA()
{
   frm=document.forms[0];
   str=txt[0]+frm.ttl.value+txt[1]+'<hr />'+frm.ttl.value+'<br /><br />';
   str+='Answer to Question # '+frm.Qnum.value+'<br /><br />';
   str+=frm.Atxt.value+'<br /><br /><a href="'+frm.nextQ.value+'">';
   str+='Click here for next question</a><br /><br />'+txt[6];
   str+=formatdate()+txt[7];
   return str;
}
function writeOptions(cnt)
{
   frm=document.forms[0];
   for (i=0;i<cnt;i++)
   {
      x='opttxt'+i;
      frm.elements[x].disabled=false;
   }
}
function disableOptions()
{
   for (i=0;i<5;i++)
   {
      frm=document.forms[0];
      x='opttxt'+i;
      frm.elements[x].disabled=true;
   }
}
//-->
</script>
</head>
<body>
<form>
Title: <input name="ttl" type="text">
Question No: <input name="Qnum">
Answer Link URL: <input name="anspage"><br />
Question Text: <textarea name="Qtxt" rows="3" cols="60"></textarea><br />
Answer Text: <textarea name="Atxt" rows="3" cols="60"></textarea><br />
Number of options: <input name="optcnt"
onchange="writeOptions(parseInt(this.value));this.form.opttxt0.focus()">
<br />
<input name="opttxt0" type="text" disabled value="A)">
<input name="opttxt1" type="text" disabled value="B)">
<input name="opttxt2" type="text" disabled value="C)">
<input name="opttxt3" type="text" disabled value="D)">
<input name="opttxt4" type="text" disabled value="E)">
<br />Next Question Page URL: <input name="nextQ"><br /><br />
Page Code:<br />
<textarea name="thecode" rows="10" cols="60"></textarea>
<br />
<input type="button" value="Show Question Code"
   onclick="this.form.thecode.value=generateQ()">
<input type="button" value="Show Answer Code"
   onclick="this.form.thecode.value=generateA()">
<input type="reset" onclick="disableOptions()">
</form>
</body>
</html>

Instructions:
1. Fill in the fields
2. Click generate question code.
3. Select the text in the page code textarea and paste it into a notepad file.
4. Save the file
5. Click generate answer code and select and save that.
6. click reset to clear teh form and go to the next page.

Cd&

0
 
webwomanCommented:
Better yet, use a database. ;-)

Then you can modify the questions/answers without having to redo the HTML, have more than 3 answers if you want, and if you want to change the design of the page, you have 1 or 2 pages to change, not 300.  
0
 
Steve3kAuthor Commented:
Wow!  Cd& - you definitely have earned points on that answer.  That's something I can tweak for future applications.

Webwoman - If you can talk me through how to do this using a database (I have MS Access) I will start up a new question to track the points for you at the same level as this question.  Let me know if this is something you'd be willing to do and I'll create the new question to track the points.

Thanks to both of you!

Steve
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
COBOLdinosaurCommented:
Glad we could help.  Thanks for the A. :^)

Cd&
0
 
webwomanCommented:
I can do better than talk you through -- I can zip up a database and the code for the quiz AND the scoring. I can't do it right now though. When you're ready, post a question and I'll get it all together. ;-)
0
 
Steve3kAuthor Commented:
Oops - I meant to ask a question about Cd&'s answer above.

What would I need to do to the script if I wanted to open a different link based on the answer that is selected?  For example:

If answer (A) is the correct answer and (A) is chosen, open a page that says "Correct" with a link to the next question.  If (B) is chosen, open a page that says "Incorrect" with an explanation why that answer is not the correct answer.  This page would have a link back to the question that was just answered and another link to the next question.

Thanks again!

Steve
0
 
Steve3kAuthor Commented:
Webwoman -

Done!  If possible, I would like to incorporate the same type of revision I posted above to Cd&.  Also, any tips you can give on how to revise the database on my own would be appreciated.

And it (almost) goes without saying -- you two are awesome!

Steve
0
 
COBOLdinosaurCommented:
Steve,

You would need to add additional inputs for the links to be entered and put them into generated strings.  You would also need to add events or scripting to test for correctness.

However I would advise against that, because it would introduce an easy way to cheat.  The re-direction from the client would require the answer to be available on the page. A user could simply view the source to see what the correct answer is.  You really need to check correctness on the server side, and then send back the approprate page, so that the users cannot peek at the answers.

Cd&
0
 
kls_techCommented:
Webwoman,

Did you ever get around to doing this?...
"...
I can do better than talk you through -- I can zip up a database and the code for the quiz AND the scoring. I can't do it right now though...."

This is exactly what I'm looking for.

Thx, kls_tech
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now