## WeBWorK Problems

by Murray Eisenberg -
Number of replies: 3
Is it possible to add the equivalent of the standard html attribute target="_blank" for an html link reference within a question -- so that the target page will open in a new window rather than replace the current window containing the question? How?

(If not, this is annoying, as it means that a call to a utility, e.g., a plotter, does not readily allow students to use the utility at the same time as they are working on the problem.)

by Jason Aubrey -
Murray,

You can do this with javascript. An example is given here:

Jason

by Murray Eisenberg -
Thanks.

Does your answer mean there's no direct way to exploit the standard html target attribute? I find that surprising!

Also, in the example to which you refer, the URL is hardcoded into the javascript. That's a bit unpleasant, as it means that one would need multiple version of essentially the same javascript function definition in case one wanted links to two different URL's on the same page.
htmlLink($url,$text, $option) which becomes <a href="$url" $option >$text</a>