\Configure{quiz*}
{qthis=this;
ProcessQuestion(\ANS,"\alph{quizno}",\thequestionno,
0,"\eq@bqlabel",\Quiz:N)}
-_-_-
\JavaScript-$
var QuizInitialized;
var EndQuizPushed;
var CurrentQuizNo;
var Responses;
var ResponsesAddr;
var Cor;
var CorAddr;
var qthis;
var prev_notify;
function InitializeQuiz(qtfield,mark,quizN,ansN,lbrc,rbrc) {
Score=0;
QuizInitialized=1;
CurrentQuizNo=quizN;
eval( ’document.form’+qtfield+’.’+qtfield+’.value="$eqScore";’ )
RightWrong=new Array();
<.hide sol.>
Responses=new Array();
ResponsesAddr=new Array();
<.hide cor.>
Cor=new Array();
CorAddr=new Array();
EndQuizPushed=0;
for(var i=1; i<=ansN; i++){
RightWrong[i]=0;
}
}
\EndJavaScript -_-_-
if( ResponsesAddr[probno] != null ){
if (notify == 0 ) {
ResponsesAddr[probno].value=Responses[probno];
} else {
ResponsesAddr[probno].value="("+Responses[probno]+")";
} }
qthis.value = "#"; ResponsesAddr[probno]=qthis;
-_-_-
for(var i in Responses){
if (prev_notify == 0 ) {
ResponsesAddr[i].value=Responses[i];
} else {
ResponsesAddr[i].value="("+Responses[i]+")";
} }
-_-_-
var k=Cor.length;
eval(’Cor[k]=thisform’+quizN+’.ans’+quizN+’x’+i+’.value’);
eval(’CorAddr[k]=thisform’+quizN+’.ans’+quizN+’x’+i);
-_-_-
for(var i in Cor){
CorAddr[i].value=Cor[i];
}
-_-_-
\JavaScript
function href(addr) { top.location.href=addr; }
\EndJavaScript
-_-_-
\JavaScript
function Corrections(lbl1,lbl2,quizN) {
if ( (EndQuizPushed == 1) && ( CurrentQuizNo == quizN ) ){
for(var i in RightWrong){
if( (RightWrong[i]==0) ){
<.record cor.>
eval(’thisform’+quizN+’.ans’+quizN+’x’+i+’.value= "*"’);
} }
} }
\EndJavaScript -_-_-
\JavaScript
function LinkTo(addr) {
}
\EndJavaScript
-_-_-
\def\eqXInitQuizMsg{\hbox{%
\let\noexpand=\string
\csname eq@InitQuizMsg\endcsname}}
\expandafter\ifx \csname eq@InitQuizMsg\endcsname\relax
\expandafter\def\csname eq@InitQuizMsg\endcsname{
"You must initialize the Quiz! Click on "+bqlabel}
\fi
\def\eqXQuizTotalMsg{\hbox{%
\let\noexpand=\string
\def\thequestionno{"+thequestionno+"}%
\csname eq@QuizTotalMsg\endcsname}}
\expandafter\ifx \csname eq@QuizTotalMsg\endcsname\relax
\expandafter\def\csname eq@QuizTotalMsg\endcsname{"Score: ’
+Score +’ out of ’+thequestionno+’"}
\fi
\def\eqXMadeChoice{\hbox{%
\let\noexpand=\string
\csname eq@MadeChoice\endcsname}}
\expandafter\ifx \csname eq@MadeChoice\endcsname\relax
\expandafter\def\csname eq@MadeChoice\endcsname{
"You have already made a choice. Your choice was ("
+Responses[probno]+")."
+" Do you want to change it?"}
\fi
\expandafter\ifx \csname eqScore\endcsname\relax
\def\eqScore{Score:}
\fi
-_-_-
The Wollen Sie dies \noexpand\344ndern? is a problem because it takes the
\344 into 44. A \string will properly produce \344; hence, the above dirty
trick.
Doesn’t IE escape in the way that Acrobat JavaScript does?
Another possibility is to use String.fromCharCode()
Convert Octal \344 to decimal 228, then use
String.fromCharCode(228)
How to deliver browser specific content using JavaScript
<SCRIPT LANGUAGE="JavaScript">
<!--
if( -1 != navigator.userAgent.
indexOf ("AOL") )
{
// load America Online version
location.href="aol.htm";
}
else
if( -1 != navigator.userAgent.
indexOf ("MSIE") )
{
// load Microsoft Internet
// Explorer version
location.href="msie.htm";
}
else
if( -1 != navigator.userAgent.
indexOf ("Mozilla") )
{
// load Netscape version
location.href="netscape.htm";
}
else
{
// load other version
location.href="other.htm";
}
-->
</SCRIPT>
\JavaScript-$
function QuizEnd(bqlabel,thequestionno,quiztotal,quizN){
if ((QuizInitialized !=1) || ( CurrentQuizNo!= quizN )){
alert($eqXInitQuizMsg,3);
} else {
eval( ’document.form’+quiztotal+’.’+quiztotal+
’.value=$eqXQuizTotalMsg’);
QuizInitialized=-1;
EndQuizPushed=1;
} }
\EndJavaScript
\JavaScript-$
function ProcessQuestion
(key,letterresp,probno,notify,bqlabel,quizN) {
if ((QuizInitialized !=1) || ( CurrentQuizNo!= quizN )){
alert($eqXInitQuizMsg,3);
} else {
<.function ProcUserResp(key,letterresp,probno,notify).>
prev_notify = notify;
} }
\EndJavaScript -_-_-
if (Responses[probno] == null) {
if (key==1) {
Score++;
RightWrong[probno]=1;
}
else
RightWrong[probno]=0;
<.show sol.>
Responses[probno]=letterresp;
}
else {
if (notify==0)
User=true;
else
User=confirm($eqXMadeChoice);
if (User) {
if (RightWrong[probno]==1) {
if (key==0) {
Score -= 1;
RightWrong[probno]=0;
<.show sol.>
Responses[probno]=letterresp;
}
}
else {
if (key==1) {
Score++;
RightWrong[probno]=1;
<.show sol.>
Responses[probno]=letterresp;
}
else {
RightWrong[probno]=0;
<.show sol.>
Responses[probno]=letterresp;
}
}
}
} -_-_-