\Configure{Form}{}{}
\Configure{@HEAD}{\input exerqz.4ht }
\Css{.onClick {color:green;}}
\Configure{TextField::}{}{%
\IgnorePar \EndP
\HCode{<form action="." name="form\quiz@total"><input
type="text"\Hnewline \Attributes /></form>}%
}
\Configure{javascript}{JavaScript:}
-_-_-
\ifx \eq@sqrtmsg\:UnDef
\def\eq@sqrtmsg{"Right!"}
\fi
\ifx \eq@sqwgmsg\:UnDef
\def\eq@sqwgmsg{"Wrong!"}
\fi
\Configure{shortquiz}
{(\alph{quizno})}
{alert(\eq@sqrtmsg,3);}
{alert(\eq@sqwgmsg,3);}
\Configure{quiz}
{(\alph{quizno})}
{qthis=this;
ProcessQuestion (\ANS,"\alph{quizno}",\thequestionno,
1,"\eq@bqlabel",\Quiz:N)}
{InitializeQuiz("\quiz@total",
\ifeq@nocorrections0\else1\fi,\Quiz:N,\LikeRef{ans-\Quiz:N},
"(",")")}
{QuizEnd("\:bqlabel",\thequestionno,"\quiz@total",\Quiz:N)}
{Corrections("\eq@RC","\eq@AC",\Quiz:N)}
\Configure{quiz*}
{[]}
{qthis=this;
ProcessQuestion (\ANS,"[]",\thequestionno,
0,"\eq@bqlabel",\Quiz:N)}
{InitializeQuiz("\quiz@total",
\ifeq@nocorrections0\else1\fi,\Quiz:N,
\LikeRef{ans-\Quiz:N},"","")}
-_-_-
\Configure{quiz*}
{qthis=this;
ProcessQuestion(\ANS,"\alph{quizno}",\thequestionno,
0,"\eq@bqlabel",\Quiz:N)}
-_-_-
\ConfigureEnv{shortquiz}
{\IgnorePar\EndP\leavevmode} {} {}{}
\Configure{ReturnTo}{\begin{flushright}}{\end{flushright}}
-_-_-
\ConfigureList{questions}%
{\EndP\HCode{<ol type="1" class="questions"\Hnewline
>}<.save end:itm.>\global\let\end:itm=\empty}
{<.recall end:itm.>\EndP\HCode{</li></ol>}\ShowPar}
{\end:itm \global\def\end:itm{\EndP\Tg</li>}\DeleteMark}
{\HCode{<li class="questions">}\AnchorLabel} -_-_-
\def\a:temp#1#2{%
\ifOption{#2}{\def\a:charset{#2}}{}
\def\:tempa{#1}\ifx \eqOutOf\:tempa
\def\A:charset{#2}\ifx \A:charset\empty\else
\def\A:charset{#2}%
\fi\fi}
\a:temp{sur}{charset=iso-8859-2}
\a:temp{von}{charset=iso-8859-2}
-_-_-
\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 -_-_-
\immediate\write16{%
***********************************************************\Hnewline
The ‘\eq@CA’ button fails under Netscape, \Hnewline
due to a code of the following form.\Hnewline
\Hnewline
<html><head><title>?</title>\Hnewline
<script\space type="text/JavaScript"\space ><!--\space \Hnewline
\space \space \space function\space f()\space {\Hnewline
\space \space \space \space \space formxx.inputxx.value="BBB";\Hnewline
\space \space \space}\Hnewline
//-->\space \Hnewline
</script>\space \space </head>\space <body>\Hnewline
\Hnewline
<form\space id="formxx">\space \space \Hnewline
\space \space \space <input\space type="text"\space
\space name="foo"\space id="inputxx"\space
\space value="AAA"\space />\Hnewline
\space \space \space <input\space value="\eq@CA"\space
type="button"\space \space \space onClick="f()"\space />\Hnewline
\space \space \space <input\space value="CLEAR"\space
type="reset"\space \space \space onClick="clear()"\space />\Hnewline
</form>\Hnewline
\Hnewline
</body> \Hnewline
</html> \Hnewline
\Hnewline
If you know how to fix the function f() above for Netscape,\Hnewline
without changing the id attribute names, please consider\Hnewline
emailing the fix to [email protected]. Thanks\Hnewline
***********************************************************} -_-_-
\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;
}
}
}
} -_-_-