Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-04-02
9
Medium Priority
?
225 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 2000 total points
ID: 10748743
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
ID: 10752314
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
ID: 10758419
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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10758659
Glad we could help.  Thanks for the A. :^)

Cd&
0
 
LVL 19

Expert Comment

by:webwoman
ID: 10758706
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
ID: 10759048
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
ID: 10759157
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
ID: 10759822
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
ID: 10847077
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
Suggested Courses

885 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