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.)
Murray,
You can do this with javascript. An example is given here:
http://webwork.maa.org/wiki/HtmlLinks
Jason
You can do this with javascript. An example is given here:
http://webwork.maa.org/wiki/HtmlLinks
Jason
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.
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.
It is not documented, unfortunately, but you can do what you want. The macro allows an extra variable:
htmlLink($url, $text, $option)
which becomes
<a href="$url" $option >$text</a>
You can put any string you want in $option including
target="_blank".
Since there is no error checking you can get complete HTML garbage if you put the wrong thing in the last slot, which is probably why it wasn't documented. It deserves to be rewritten with more safe features. :-)
-- Mike
htmlLink($url, $text, $option)
which becomes
<a href="$url" $option >$text</a>
You can put any string you want in $option including
target="_blank".
Since there is no error checking you can get complete HTML garbage if you put the wrong thing in the last slot, which is probably why it wasn't documented. It deserves to be rewritten with more safe features. :-)
-- Mike