Preventing Printing or Copying Quizzes or Exams

Electronic quizzes are a wonderful assessment tool. Faculty can create test banks of questions (or use a publisher's testbank) and then set the quiz to randomize a group of questions so that every student gets a different quiz or a different order of questions. Faculty can even randomize the answers in individual questions so that even if two students get the same question on a quiz, their answers will be in different order! Quizzes can be set to turn on and off to limit student access and can be set so that students can take them multiple times. The best part is that these quizzes are electronically scored and recorded. This means that as soon as the students submit their quizzes, they get their grade and then the grade is automatically added to the online grade book in WebCT. Pretty nifty!

However, one concern that faculty who use these quizzes have had is that students can print out a copy of the quiz or copy-paste the quiz into Word. Here is a script that can be pasted into an upper textblock of a quiz that will actually prevent students from selecting the questions, copying any of the question and answers or printing the test.  This code works with recent versions of Internet Explorer, Firefox and Netscape.

To use this option:

1.    Click on the title of a quiz you've created in the Quiz Editor to open the quiz

2.    Scroll down the menu on the right towards the bottom and click on "Edit/Add upper textblock." This upper text box is usually used to add a note or instructions for your students that they will see before taking a quiz. However, you may also use it to add scripts or HTML code to your quiz.

3.    The textblock editing box will appear. Copy the following code starting from the <head> and ending with the </script> and paste it into this textblock, then click Update. The code itself will be completely invisible to your students but they won't be able to copy or print the quiz from the menu bar or with right-click features like control "a" / control "c" / control "v" ability to select, copy and paste. Pretty cool, huh!


 

<head>

<meta http-equiv="imagetoolbar" content="no">

</head>

<style media="print">body {display:none}</style>

<body ondragstart="return false" onselectstart="return false">

 

<script language=JavaScript>

<!--

var message="It is a violation of the CCRI Student Code Of Conduct to copy or print this quiz!";

 

function clickIE4(){

if (event.button==2){

alert(message);

return false;

}

}

 

function clickNS4(e){

if (document.layers||document.getElementById&&!document.all){

if (e.which==2||e.which==3){

alert(message);

return false;

}

}

}

 

if (document.layers){

document.captureEvents(Event.MOUSEDOWN);

document.onmousedown=clickNS4;

}

else if (document.all&&!document.getElementById){

document.onmousedown=clickIE4;

}

 

document.oncontextmenu=new Function("alert(message);return false")

 

// -->

</script>

 

<script language=JavaScript>

 

</script>

 

<script type="text/javascript">

 

var omitformtags=["input", "textarea", "select"]

 

omitformtags=omitformtags.join("|")

 

function disableselect(e){

if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)

return false

}

 

function reEnable(){

return true

}

 

if (typeof document.onselectstart!="undefined")

document.onselectstart=new Function ("return false")

else{

document.onmousedown=disableselect

document.onmouseup=reEnable

}

 

</script>

 

-----------------------------------------------------------------------------------------

To test the code:

1.    Click the "Preview Quiz" button in the right-hand "Actions" menu in the quiz's Quiz Editor screen. A preview of the quiz will appear in a popup window.

2.    Attempt to right-click. A popup warning message that says "It is a violation of the CCRI Student Code Of Conduct to copy or print this quiz!" should appear.

3.    Attempt to select some text. You should not be able to.

4.    Attempt to print. A blank sheet of paper should come out of your printer.

5.    If you are using Internet Explorer, and if the quiz contains an image, attempt to right-click the image. A popup warning box should appear ("It is a violation of the CCRI Student Code Of Conduct to copy or print this quiz ") and the IE-specific "Image Toolbar" should not appear.