Forum archive 2000-2006

Michael Gage - HTML links example

Michael Gage - HTML links example

by Arnold Pizer -
Number of replies: 0
inactiveTopicHTML links example topic started 5/9/2000; 4:04:39 PM
last post 5/9/2000; 4:04:39 PM
userMichael Gage - HTML links example  blueArrow
5/9/2000; 4:04:39 PM (reads: 3098, responses: 0)

The HTML links example

To obtain this problem:

(1 pt) rochesterLibrary/setMAAtutorial/htmllinksexample/htmllinksexample.pg

HTML links example

This example shows how to link to resources outside the problem itself.

Linking to other web pages over the internet is easy. For example, you can get more information about the buffon needle problem and how it is used by ants to find new nest sites by linking to Ivars Peterson's column on the MAA site.

All of the files in the html directory of your WeBWorK course site can be read by anyone with a web browser and the URL (the address of the file). This is a good place to put files that are referenced by more than one problem in your WeBWorK course.

Here is the link to the to the calculator page stored in the top level of the html directory of the tutorialCourse.

Finally there are files, such as picture files, which are stored with the problem itself in the same directory.
MAAtutorial-prob1-2-70190.gif

And the table below has three more graphs which are stored in the directory containing the current problem.

MAAtutorial-prob1-1-24438.gif MAAtutorial-prob1-2-49261.gif MAAtutorial-prob1-3-37616.gif

 

 


WARNINGS
µ¦å{h­ Enter this code
DOCUMENT();
loadMacros("PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl"
);
$showPartialCorrectAnswers = 0;

TEXT(beginproblem(), $BR,$BBOLD, "HTML links example", $EBOLD, $BR,$BR);

BEGIN_TEXT
This example shows how to link to resources outside the problem itself.
$PAR
Linking to other web pages over the internet is easy. For example,
you can get more information about the buffon needle problem and how it is used by ants to find new nest sites by linking to
\{ htmlLink("http://www.maa.org/mathland/mathtrek_5_15_00.html",
"Ivars Peterson's column on the MAA site") \}.
$PAR
END_TEXT

# You can write the HTML code yourself, but
# that will look funny when the problem is printed in
# hard copy, so it is probably better to use the
# htmlLink('url','text') function which
# will create something readable when the problem is printed.

BEGIN_TEXT
All of the files in the html directory of your WeBWorK course site can be read
by anyone with a web browser and the URL (the address of the file). This is a good
place to put files that are referenced by more than one problem in your WeBWorK course.
$PAR
Here is the link to
the
\{ htmlLink(alias("${htmlDirectory}calc.html"),
'to the calculator page',
qq!target="ww_calculator"
ONCLICK="window.open( this.href, this.target,
'width=250,height=350,scrollbars=no,resizable=off'
)"
!) \}
stored in the top level of the
html directory of the tutorialCourse.
$PAR
END_TEXT

# To link to files on your own computer use the alias function whose
# job it is to find the file in question.
# You need to do this access indirectly, because WeBWorK is set up to
# restrict access to most files -- (you don't want everyone reading
# the source text of the WeBWorK problems, they could reconstruct the answer.)
#
# Note that you need double quotes around "${htmlDirectory}calc.html" so that
# the string in $htmlDirectory will be
# concatenated with calc.html to form a string describing
# the DIRECTORY in which the file is to be found. Alias converts
# the directory to a URL

BEGIN_TEXT
Finally there are files, such as picture files, which are
stored with the problem itself in the same directory.
$BR \{ image("2-70190.gif", width=>200, height=>200) \}

END_TEXT

# Image automatically uses alias
# to search for files.

BEGIN_TEXT
$PAR
And the table below has three more graphs which are stored
in the directory containing the current problem. $PAR
END_TEXT

TEXT(
begintable(3),
row( image( [ ( '1-24438.gif', '2-49261.gif', '3-37616.gif') ],
tex_size=>200, width=>200, height=>200 )),
endtable()
);

ENDDOCUMENT();



Comments:

This problem is just a demo -- it doesn't actually work if you push the submit answer button. (You can test a live version of this problem.)

 

<| Post or View Comments |>