|
Correct or Incorrect? A Quiz against the Clock to Copy and Paste
You have 30 seconds to decide if these 10 sentences are correct or incorrect.
When the clock starts ticking, get clicking!
This is really fun little quiz script I bashed out the other day. It's ideal for getting students to distinguish between correct and incorrect forms in a game-like fashion, so I thought I'd share it with you. If you know nothing about JavaScript, it might be wise to take a look at my page "Creating Interactive..." before proceeding. It's the core page of my site, a 101 course for developing interactive webpages.
As scripts go, this one's pretty long and complex, so I'm not going to explain how it works. I'm just going to give it to you and let you copy and paste it to use on your own site. I think the easiest thing to do is just give you a basic, no frills HTML file that's a working example of the script. You can see it below, in small type. You should open Windows Notepad, copy the code into it and save it as rightwrong.html. Then you can use this as a template and adapt it however you like at any time to make new quiz pages. As well as changing the background colours, fonts etc, you can also change the time limit and of course the sentences (you can change other stuff too but be careful!). I've included all the instructions for adaptation in comment tags within the code. They're marked with asterisks, ignore the others, which are for my benefit. Don't delete the instructions, you'll need them each time you open up the template to make a new quiz. Remember the golden rule when adapting scripts: Don't hit enter when your cursor is sitting in the middle of a line of JavaScript code as you'll screw the script up.
Have fun!
<html>
<head>
<title>Right or Wrong Race</title>
<script language="javascript">
<!--
//Script by Matt Stanton 2002
//http://members.tripod.com/matt_stanton/
//cyberefl@email.com
//This script will be useful to teachers.
//The student has to decide if 10 sentences are
//correct or incorrect against the clock.
//Only one attempt can be made at each sentence.
//The student can see if his/her answer was correct
//by looking at the score box, so most students
//should be able to clear it after a few goes.
// *** ADAPTATION INSTRUCTIONS 1 ***
// * Change "30" to the number of seconds you want:
var counter = 30;
// *
var score = 0;
var numofquests = 10;
var questclick = new Array(numofquests+1);
var timerid;
var maya=1;
function reloadpage(){
score=0;
for(var i=1;i<questclick.length;i++){
questclick[i]=0;
}
clearInterval(timerid);
document.myform.mytime.value=" Restarting...";
document.myform.myscore.value=" Your current score is 0.";
counter=30;
timerid = setInterval('timefunc()',1000);
}
//timer function
function timefunc() {
document.myform.mytime.value = " You have " + counter + " second(s) left.";
counter--;
if(counter == -1){
clearInterval(timerid);
document.myform.myscore.value = " Your final score is " + score + ".";
document.myform.mytime.value = " Sorry, time's up!";
score=0;
}
}
//set all items in array to zero
for (i=0;i<=(numofquests+1);i++){
questclick[i]=0;
}
//action for a correct answer
function right(a){
if(counter>-1 && maya == 2){
score++;
questclick[a]++;
if (questclick[a]>1){
score--;
}
dispscore();
if (score == 10){
clearInterval(timerid);
document.myform.mytime.value = " Cleared with " + counter + " second(s) left.";
document.myform.myscore.value = " Well done!";
}
}
}
//action for a wrong answer
function wrong(b){
if(counter>-1 && maya == 2){
questclick[b]++;
}
}
//score display function
function dispscore(){
document.myform.myscore.value = " Your current score is " + score + ".";
}
//-->
</script>
</head>
<body onload="maya=2;timerid=setInterval('timefunc()',1000);">
<form name="myform">
<input type="text" size="34" value=" Please wait..." name="mytime">
<input type="text" size="27" value=" Your current score is 0." name="myscore">
<input type="button" value="Restart" onClick="reloadpage();">
<br><br>
<!--
*** ADAPTATION INSTRUCTIONS 2 ***
Substitute your sentences below.
If the sentence is correct, set the value inside
the first onClick to "right", and the value inside
the second onClick to "wrong".
If the sentence is incorrect, set the value inside
the first onClick to "wrong", and the value inside
the second onClick to "right".
***
-->
<input type="button" value="Correct" onClick="right(1);">
<input type="button" value="Incorrect" onClick="wrong(1);">
1. I'm going to Tokyo on Thursday.
<br>
<input type="button" value="Correct" onClick="wrong(2);">
<input type="button" value="Incorrect" onClick="right(2);">
2. Is your birthday at March too?
<br>
<input type="button" value="Correct" onClick="wrong(3);">
<input type="button" value="Incorrect" onClick="right(3);">
3. They always go skiing on the winter.
<br>
<input type="button" value="Correct" onClick="right(4);">
<input type="button" value="Incorrect" onClick="wrong(4);">
4. I have a meeting at 10 o'clock tomorrow morning.
<br>
<input type="button" value="Correct" onClick="right(5);">
<input type="button" value="Incorrect" onClick="wrong(5);">
5. Do you usually see your parents at Christmas?
<br>
<input type="button" value="Correct" onClick="right(6);">
<input type="button" value="Incorrect" onClick="wrong(6);">
6. My little daughter often has a sleep in the afternoon.
<br>
<input type="button" value="Correct" onClick="wrong(7);">
<input type="button" value="Incorrect" onClick="right(7);">
7. Can you come at the 15th of April?
<br>
<input type="button" value="Correct" onClick="right(8);">
<input type="button" value="Incorrect" onClick="wrong(8);">
8. I don't like walking along dark streets at night.
<br>
<input type="button" value="Correct" onClick="wrong(9);">
<input type="button" value="Incorrect" onClick="right(9);">
9. She never watches TV at evening.
<br>
<input type="button" value="Correct" onClick="right(10);">
<input type="button" value="Incorrect" onClick="wrong(10);">
10. I have four days off work at Easter.
<small><small>
<br>
<br>
Script by <a href="mailto:cyberefl@email.com">Matt Stanton</a> 2002<br><a href="http://members.tripod.com/matt_stanton/">
http://members.tripod.com/matt_stanton/</a>
</small></small>
</form>
</body>
</html>
|
Last Edited: 28 May 2002 © 2002 Matt Stanton
|
|