Inserts attributes so that the 'href' will open in a new window (XHTML and quirks compatible). If included, make sure you put single quotes around it (if its a string).
The following parameters are recognized:
Optional URL (if omitted we assume we should use the 'href' attribute value).
The "target" attribute is deprecated in the stricter HTML/XHTML DOCTYPES. This macro simulates a 'target="_blank"' by assigning some JavaScript to the 'onclick' and 'onkeypress' attributes. You don't need to pass any arguments to this macro if you use it on a entity which has its 'href' attribute set. This macro can be used on ANY entity (even those without the 'href' attribute), but passing some valid JavaScript as the parameter to indicate the URL to be opened (NOTE: If you want to pass a JavaScript string, make sure you wrap it in single quotes).
Example of using the macro:
<p>Long method:</p> <a href="https://google.com/" @openNewWindowAttr(this.href)>google</a> <p>Following is "short" version which is same as above:</p> <a href="https://google.com/" @openNewWindowAttr()>google</a> <p>Following is an example of passing a fixed URL:</p> <span @openNewWindowAttr("'https://google.com'")>google</span>
Assuming the com.ccg.macros.at.All
class is within your CLASSPATH
and the
config/html.at
macros file has been
generated (Hint: run make atmacros in the
wui
directory), a developer should be able to
run the above example by copy/pasting from below:
[root@probe root]#
java com.ccg.macros.at.All <<EOF
@include("config/html.at",,"d")
<p>Long method:</p> <a href="https://google.com/" @openNewWindowAttr(this.href)>google</a> <p>Following is "short" version which is same as above:</p> <a href="https://google.com/" @openNewWindowAttr()>google</a> <p>Following is an example of passing a fixed URL:</p> <span @openNewWindowAttr("'https://google.com'")>google</span>
EOF
This macro is defined as:
@htmlAttr("onclick","window.open(@fnb("@param(0)","this.href")); return false;") @htmlAttr("onkeypress","window.open(@fnb("@param(0)","this.href")); return false;")