Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2004-04-02
9
218 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
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

809 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