Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 45 additions & 44 deletions src/lab/exp1/quizconfig.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/***********************************************
* JavaScriptKit.com Multiple Choice Quiz Script (http://www.javascriptkit.com)
* Copyright 2003 JavaScript Kit- http://www.javascriptkit.com
* This notice and footnote must stay intact for use
* Visit JavaScript Kit (http://www.javascriptkit.com/) for full source code
***********************************************/
* JavaScriptKit.com Multiple Choice Quiz Script (http://www.javascriptkit.com)
* Copyright 2003 JavaScript Kit- http://www.javascriptkit.com
* This notice and footnote must stay intact for use
* Visit JavaScript Kit (http://www.javascriptkit.com/) for full source code
***********************************************/

//Enter total number of questions:
var totalquestions=5
var correct

//Enter the solutions corresponding to each question:
var correctchoices=new Array()
Expand All @@ -19,53 +20,53 @@ correctchoices[5]='a'
/////Don't edit beyond here//////////////////////////

function gradeit(){
var incorrect=null
for (q=1;q<=totalquestions;q++){
var thequestion=eval("document.myquiz.question"+q)
for (c=0;c<thequestion.length;c++){
if (thequestion[c].checked==true)
actualchoices[q]=thequestion[c].value
var correct=null
for (q=1;q<=totalquestions;q++){
var thequestion=eval("document.myquiz.question"+q)
for (c=0;c<thequestion.length;c++){
if (thequestion[c].checked==true)
actualchoices[q]=thequestion[c].value
}
if (actualchoices[q]!=correctchoices[q]){ //process an incorrect choice
if (incorrect==null)
incorrect=q
else
incorrect+="/"+q

if (actualchoices[q]==correctchoices[q]){ //process an incorrect choice
if (correct==null)
correct=q
else
correct+="/"+q
}
}

if (incorrect==null)
incorrect="a/b"
document.cookie='q='+incorrect
if (correct==null)
correct="a/b"
document.cookie='q='+correct
if (document.cookie=='')
alert("Your browser does not accept cookies. Please adjust your browser settings.")
alert("Your browser does not accept cookies. Please adjust your browser settings.")
else
window.location="results.htm"
window.location="results.htm"
}


function showsolution(){
var win2=window.open("","win2","width=200,height=350, scrollbars")
win2.focus()
win2.document.open()
win2.document.write('<title>Solution</title>')
win2.document.write('<body bgcolor="#FFFFFF">')
win2.document.write('<center><h3>Solution to Quiz</h3></center>')
win2.document.write('<center><font face="Arial">')
for (i=1;i<=totalquestions;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
wrong=1
}
if (wrong==1){
win2.document.write("Question "+i+"="+correctchoices[i].fontcolor("red")+"<br>")
wrong=0
}
else
win2.document.write("Question "+i+"="+correctchoices[i]+"<br>")
}
win2.document.write('</center></font>')
win2.document.write("<h5>Note: The solutions in red are the ones to the questions you had incorrectly answered.</h5>")
win2.document.close()
var win2=window.open("","win2","width=200,height=350, scrollbars")
win2.focus()
win2.document.open()
win2.document.write('<title>Solution</title>')
win2.document.write('<body bgcolor="#FFFFFF">')
win2.document.write('<center><h3>Solution to Quiz</h3></center>')
win2.document.write('<center><font face="Arial">')
for (i=1;i<=totalquestions;i++){
for (temp=0;temp<incorrect.length;temp++){
if (i==incorrect[temp])
wrong=1
}
if (wrong==1){
win2.document.write("Question "+i+"="+correctchoices[i].fontcolor("red")+"<br>")
wrong=0
}
else
win2.document.write("Question "+i+"="+correctchoices[i]+"<br>")
}
win2.document.write('</center></font>')
win2.document.write("<h5>Note: The solutions in red are the ones to the questions you had incorrectly answered.</h5>")
win2.document.close()
}
18 changes: 9 additions & 9 deletions src/lab/exp1/results.htm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<td height="25"><p><input type="text" name="p" size="24"></td>
</tr>
<tr>
<td height="17" bgcolor="#D3FFA8"><strong><font face="Arial">The questions you got wrong:</font></strong></td>
<td height="17" bgcolor="#D3FFA8"><strong><font face="Arial">The questions you got right:</font></strong></td>
<td height="17"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>
</tr>
<tr>
Expand Down Expand Up @@ -51,14 +51,14 @@

}

var incorrect=results[parse].split("=")
incorrect=incorrect[1].split("/")
if (incorrect[incorrect.length-1]=='b')
incorrect=""
document.result[0].value=totalquestions-incorrect.length+" out of "+totalquestions
document.result[2].value=(totalquestions-incorrect.length)/totalquestions*100+"%"
for (temp=0;temp<incorrect.length;temp++)
document.result[1].value+=incorrect[temp]+", "
var correct=results[parse].split("=")
correct=correct[1].split("/")
if (correct[correct.length-1]=='b')
correct=""
document.result[0].value=correct.length+" out of "+totalquestions
document.result[2].value=(correct.length)/totalquestions*100+"%"
for (temp=0;temp<correct.length;temp++)
document.result[1].value+=correct[temp]+", "


</script>
Expand Down
18 changes: 9 additions & 9 deletions src/lab/exp2/quizconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ correctchoices[5]='a'
/////Don't edit beyond here//////////////////////////

function gradeit(){
var incorrect=null
var correct=null
for (q=1;q<=totalquestions;q++){
var thequestion=eval("document.myquiz.question"+q)
for (c=0;c<thequestion.length;c++){
if (thequestion[c].checked==true)
actualchoices[q]=thequestion[c].value
}
if (actualchoices[q]!=correctchoices[q]){ //process an incorrect choice
if (incorrect==null)
incorrect=q

if (actualchoices[q]==correctchoices[q]){ //process an incorrect choice
if (correct==null)
correct=q
else
incorrect+="/"+q
correct+="/"+q
}
}

if (incorrect==null)
incorrect="a/b"
document.cookie='q='+incorrect
if (correct==null)
correct="a/b"
document.cookie='q='+correct
if (document.cookie=='')
alert("Your browser does not accept cookies. Please adjust your browser settings.")
else
Expand Down
18 changes: 9 additions & 9 deletions src/lab/exp2/results.htm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<td height="25"><p><input type="text" name="p" size="24"></td>
</tr>
<tr>
<td height="17" bgcolor="#D3FFA8"><strong><font face="Arial">The questions you got wrong:</font></strong></td>
<td height="17" bgcolor="#D3FFA8"><strong><font face="Arial">The questions you got right:</font></strong></td>
<td height="17"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>
</tr>
<tr>
Expand Down Expand Up @@ -51,14 +51,14 @@

}

var incorrect=results[parse].split("=")
incorrect=incorrect[1].split("/")
if (incorrect[incorrect.length-1]=='b')
incorrect=""
document.result[0].value=totalquestions-incorrect.length+" out of "+totalquestions
document.result[2].value=(totalquestions-incorrect.length)/totalquestions*100+"%"
for (temp=0;temp<incorrect.length;temp++)
document.result[1].value+=incorrect[temp]+", "
var correct=results[parse].split("=")
correct=correct[1].split("/")
if (correct[correct.length-1]=='b')
correct=""
document.result[0].value=correct.length+" out of "+totalquestions
document.result[2].value=(correct.length)/totalquestions*100+"%"
for (temp=0;temp<correct.length;temp++)
document.result[1].value+=correct[temp]+", "


</script>
Expand Down
18 changes: 9 additions & 9 deletions src/lab/exp3/quizconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ correctchoices[5]='a'
/////Don't edit beyond here//////////////////////////

function gradeit(){
var incorrect=null
var correct=null
for (q=1;q<=totalquestions;q++){
var thequestion=eval("document.myquiz.question"+q)
for (c=0;c<thequestion.length;c++){
if (thequestion[c].checked==true)
actualchoices[q]=thequestion[c].value
}
if (actualchoices[q]!=correctchoices[q]){ //process an incorrect choice
if (incorrect==null)
incorrect=q

if (actualchoices[q]==correctchoices[q]){ //process an incorrect choice
if (correct==null)
correct=q
else
incorrect+="/"+q
correct+="/"+q
}
}

if (incorrect==null)
incorrect="a/b"
document.cookie='q='+incorrect
if (correct==null)
correct="a/b"
document.cookie='q='+correct
if (document.cookie=='')
alert("Your browser does not accept cookies. Please adjust your browser settings.")
else
Expand Down
18 changes: 9 additions & 9 deletions src/lab/exp3/results.htm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<td height="25"><p><input type="text" name="p" size="24"></td>
</tr>
<tr>
<td height="17" bgcolor="#D3FFA8"><strong><font face="Arial">The questions you got wrong:</font></strong></td>
<td height="17" bgcolor="#D3FFA8"><strong><font face="Arial">The questions you got right:</font></strong></td>
<td height="17"><p><textarea name="T2" rows="3" cols="24" wrap="virtual"></textarea></td>
</tr>
<tr>
Expand Down Expand Up @@ -51,14 +51,14 @@

}

var incorrect=results[parse].split("=")
incorrect=incorrect[1].split("/")
if (incorrect[incorrect.length-1]=='b')
incorrect=""
document.result[0].value=totalquestions-incorrect.length+" out of "+totalquestions
document.result[2].value=(totalquestions-incorrect.length)/totalquestions*100+"%"
for (temp=0;temp<incorrect.length;temp++)
document.result[1].value+=incorrect[temp]+", "
var correct=results[parse].split("=")
correct=correct[1].split("/")
if (correct[correct.length-1]=='b')
correct=""
document.result[0].value=correct.length+" out of "+totalquestions
document.result[2].value=(correct.length)/totalquestions*100+"%"
for (temp=0;temp<correct.length;temp++)
document.result[1].value+=correct[temp]+", "


</script>
Expand Down