0

I was hoping someone can help me with a html code for a quiz. I have searched for templates and examples and couldn't find any that would work. Most questions are True or False with a couple with multiple choice. Example:

It can be all redial buttons and once the user has finished and pressed the submit button, the site will indicated the answers by either selecting the correct answer in green or indintifying the correct answer with a green arrow next to it.

Any help would be great as this is merely experimental. It doesn't have to be secured so if a user mouse right clicks on the site to view the source code it's no big deal.

Thanks for the help.

2
Contributors
1
Reply
12
Views
3 Years
Discussion Span
Last Post by wikit
0

well I dont have a script that will tell them which ones are CORRECT but i will give you one for a quiz that simply tells them they need to try again.

<html>
<head>
<script LANGUAGE="Javascript">
<!--Start Javacrap here--
q1=0;
q2=0;
q3=0;
function Scoring(){
score = q1 + q2 + q3;
if(score<90){
alert("Sorry! Try again! ^_^")
}
else {
location = "redirect-to-congrats-page.html";}
}

function clear(){
q1 = 0;
q2 = 0;
q3 = 0;
}
//--End o' Javastuff-->
   </script><script language="JavaScript1.2"> 
if (window.Event) 
document.captureEvents(Event.MOUSEUP); 
function nocontextmenu()  
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)    
{
if (window.Event)   
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}   
}
document.oncontextmenu = nocontextmenu;     
document.onmousedown = norightclick;        
   </script>
<script language="JavaScript"> <!--
var message="No Right Click."; // Message for the alert box
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// --> </script>

<script>
document.onkeydown = function ()
{
 if (122 == event.keyCode)
 {
  event.keyCode = 0;
  return = false;
 }
}
</script>
</head>
<body>

<center><form NAME="FormI"></center>

<table>
<tr><td>1. question 1?</td></tr>

<tr>
<td><input TYPE="radio" border="0" NAME="1" onClick="q1 = 0">a. answer 1
<br><input TYPE="radio" border="0" NAME="1" onClick="q1 = 30">b. answer 2
<br><input TYPE="radio" border="0" NAME="1" onClick="q1 = 0">c. answer 3</font>
</tr>

<tr><td>1. question 2?</td></tr>

<tr>
<td><input TYPE="radio" border="0" NAME="2" onClick="q2 = 30">a. answer 1
<br><input TYPE="radio" border="0" NAME="2" onClick="q2 = 0">b. answer 2
<br><input TYPE="radio" border="0" NAME="2" onClick="q2 = 0">c. answer 3
</tr>

<tr><td>1. question 3?</td></tr>

<tr>
<td><input TYPE="radio" border="0" NAME="3" onClick="q3 = 0">a. answer 1
<br><input TYPE="radio" border="0" NAME="3" onClick="q3 = 30">b. answer 2
<br><input TYPE="radio" border="0" NAME="3" onClick="q3 = 0">c. answer 3
</td>
</tr>

<tr>
<td ALIGN=CENTER><font face="Verdana"><input TYPE="BUTTON" ONCLICK="Scoring()" value="Done"><input TYPE="reset" value="Reset"></font></td>
</tr>
</table>
</form>
</body>
</html>

to indicate the CORRECT answers change the onClick="q3 = 0" etc. each answer set should have 1 answer set to =30 this script is for if the quiz has 3 questions.

you can add more questions or answer choices. if you add more questions change

    q1=0;
    q2=0;
    q3=0;
    function Scoring(){
    score = q1 + q2 + q3;
    if(score<90){

make sure you add the other questions q4=0; etc and change the score line and ofc change the final score value.

have fun if this helps <3

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.