@javascriptButtonAttr(CODE, LABEL, [TITLE], [ATTRS])

Inserts attributes for a clickable button that executes JavaScript code on click.

The following parameters are recognized:

CODE

The javascript code to execute.

LABEL

The label to appear on the button.

[TITLE]

The tooltip text to appear with button.

[ATTRS]

Optional set of attributes to apply to input entity.

Example of using the macro:

@javascriptBegin()
function showAlert() {
  alert("Hello World!");
}
@javascriptEnd()

<input @javascriptButtonAttr("showAlert();","Alert!","Press to see alert message") @htmlAttr("style","width: 1in;") />

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")

@javascriptBegin()
function showAlert() {
  alert("Hello World!");
}
@javascriptEnd()

<input @javascriptButtonAttr("showAlert();","Alert!","Press to see alert message") @htmlAttr("style","width: 1in;") />

EOF

This macro is defined as:

@ifEqual("@param(3)",,"@wuiInputButtonAttr("jsButton","@param(1)")","@wuiInputButtonAttr("jsButton","@param(1)",,"@param(3)")")
  @htmlAttr("onclick","@param(0)")
  @toolTipAttr("@param(2)")