Difference between revisions of "AnswerFormatHelp"
(9 intermediate revisions by 2 users not shown) | |||
Line 76: | Line 76: | ||
<p> |
<p> |
||
<b>Main Text:</b> |
<b>Main Text:</b> |
||
− | We use <code>AnswerFormatHelp("equations")</code> to generate a link to an html help file |
+ | We use <code>AnswerFormatHelp("equations")</code> to generate a link to an html help file with link text <code>help (equations)</code>. The html help files are specifically designed to help students figure out the correct syntax for their answer, as well as common mistakes to avoid. We recommend placing a help link immediately after each answer blank in a problem, especially if there are different types of answers. Currently, help files are available for |
<ul> |
<ul> |
||
<li>angles</li> |
<li>angles</li> |
||
Line 93: | Line 93: | ||
<li>vectors</li> |
<li>vectors</li> |
||
</ul> |
</ul> |
||
− | It is possible to change the link text by including a second argument to the routine: |
||
+ | </p> |
||
+ | <p> |
||
+ | It is possible to change the link text to <code>help entering equations</code> by including a second argument to the routine: |
||
<pre> |
<pre> |
||
− | \{ AnswerFormatHelp(" |
+ | \{ AnswerFormatHelp("equations","help entering equations") \} |
</pre> |
</pre> |
||
+ | </p> |
||
+ | <p> |
||
+ | It is possible to provide a link to an external help file using <code>\{ htmlLink("http://someplace.edu/help.html") \}</code>. We do not recommend this as it requires external files be maintained and links not become broken (especially when the server changes or moves). Instead of using a link to an external help file, use the method described at the bottom of this page. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 115: | Line 120: | ||
<p> |
<p> |
||
<b>Answer Evaluation:</b> |
<b>Answer Evaluation:</b> |
||
− | As is the answer. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 124: | Line 128: | ||
[[IndexOfProblemTechniques|Problem Techniques Index]] |
[[IndexOfProblemTechniques|Problem Techniques Index]] |
||
</p> |
</p> |
||
+ | |||
+ | |||
+ | <p> |
||
+ | Instead of using a link to an external file, use the following: |
||
+ | |||
+ | <pre> |
||
+ | HEADER_TEXT(<<END_HEADER_TEXT); |
||
+ | <script type="text/javascript"> |
||
+ | <!-- |
||
+ | function openhelpCustom1() { |
||
+ | OpenWindow=window.open("","answer_format_help","width=550,height=550,status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=1,scrollbars=1"); |
||
+ | OpenWindow.document.write("<title>Help With Something</title>") |
||
+ | OpenWindow.document.write("<body bgcolor='#ffffff'>") |
||
+ | OpenWindow.document.write("<center><h2>Help With Something</h2></center>") |
||
+ | OpenWindow.document.write("<ul>") |
||
+ | OpenWindow.document.write("<li><font color='#222255'>Header:</font><blockquote>Explanation <code>pi/3</code></blockquote></li>") |
||
+ | OpenWindow.document.write("<li><font color='#222255'>Header:</font><blockquote>Explanation <code>pi/3</code></blockquote></li>") |
||
+ | OpenWindow.document.write("</ul>") |
||
+ | OpenWindow.document.write("</body>") |
||
+ | OpenWindow.document.write("</html>") |
||
+ | OpenWindow.document.close() |
||
+ | self.name="main" |
||
+ | if (window.focus) {OpenWindow.focus()} |
||
+ | return false; |
||
+ | } |
||
+ | --> |
||
+ | </script> |
||
+ | END_HEADER_TEXT |
||
+ | |||
+ | |||
+ | BEGIN_TEXT |
||
+ | |||
+ | \{ htmlLink("#","help (something)","onClick='openhelpCustom1()';") \} |
||
+ | END_TEXT |
||
+ | </pre> |
||
+ | </p> |
||
+ | |||
[[Category:Problem Techniques]] |
[[Category:Problem Techniques]] |
Revision as of 01:52, 16 January 2011
Answer Format Help Links
This PG code shows how to add answer format help links to problems.
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "AnswerFormatHelp.pl", "parserImplicitPlane.pl", ); TEXT(beginproblem()); |
Initialization:
We need to include the macros file |
Context("ImplicitPlane")->variables->are(x=>"Real",y=>"Real"); $answer = ImplicitPlane("x+y=2"); |
Setup:
By declaring there are only two variables, |
BEGIN_TEXT Enter an equation for a line through the points \( (0,2) \) and \( (2,0) \). $BR $BR \{ ans_rule(20) \} \{ AnswerFormatHelp("equations") \} END_TEXT |
Main Text:
We use
It is possible to change the link text to \{ AnswerFormatHelp("equations","help entering equations") \}
It is possible to provide a link to an external help file using |
$showPartialCorrectAnswers = 1; ANS( $answer->cmp() ); ENDDOCUMENT(); |
Answer Evaluation: |
Instead of using a link to an external file, use the following:
HEADER_TEXT(<<END_HEADER_TEXT); <script type="text/javascript"> <!-- function openhelpCustom1() { OpenWindow=window.open("","answer_format_help","width=550,height=550,status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=1,scrollbars=1"); OpenWindow.document.write("<title>Help With Something</title>") OpenWindow.document.write("<body bgcolor='#ffffff'>") OpenWindow.document.write("<center><h2>Help With Something</h2></center>") OpenWindow.document.write("<ul>") OpenWindow.document.write("<li><font color='#222255'>Header:</font><blockquote>Explanation <code>pi/3</code></blockquote></li>") OpenWindow.document.write("<li><font color='#222255'>Header:</font><blockquote>Explanation <code>pi/3</code></blockquote></li>") OpenWindow.document.write("</ul>") OpenWindow.document.write("</body>") OpenWindow.document.write("</html>") OpenWindow.document.close() self.name="main" if (window.focus) {OpenWindow.focus()} return false; } --> </script> END_HEADER_TEXT BEGIN_TEXT \{ htmlLink("#","help (something)","onClick='openhelpCustom1()';") \} END_TEXT