Solved

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

Posted on 2004-04-02
9
216 Views
Last Modified: 2010-04-07
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
Comment
Question by:Steve3k
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
Comment Utility
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
 
LVL 19

Expert Comment

by:webwoman
Comment Utility
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
 
LVL 1

Author Comment

by:Steve3k
Comment Utility
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
Glad we could help.  Thanks for the A. :^)

Cd&
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 19

Expert Comment

by:webwoman
Comment Utility
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
 
LVL 1

Author Comment

by:Steve3k
Comment Utility
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
 
LVL 1

Author Comment

by:Steve3k
Comment Utility
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
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
 

Expert Comment

by:kls_tech
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now