iTP Active Transaction Pages (iTP ATP) Programmer's Guide

ATP Objects, Properties, and Methods
iTP Active Transaction Pages (iTP ATP) Programmer’s Guide522292-002
4-51
Global Functions
atp.quit(integer)
This function stops processing of the current .atp page and flushes all output to the
web browser. A zero (0) parameter indicates failure; in such cases, a JavaScript alert
message is also displayed. A non-zero parameter indicates that no alert message should
be displayed. The default value for the parameter is zero (0).
return = atp.escape (string)
This function modifies a string by replacing each special character with its hexadecimal
equivalent in the form %xx to allow the use of the string in a query URL.
The following function (not part of ATP) would have the reverse effect, replacing a
hexadecimal number with the corresponding special character:
<server>
function unescape (s) {
var i;
var str_out;
str_out = '';
for (i=0; i<s.length; i++) {
var c;
c = s.substring(i,i+1);
if (c.indexOf('%') == 0)
str_out += '\\x';
else
str_out += c;
}
str_out = eval ('"'+str_out+'"');
return str_out;
}
atp.print
(unescape(‘add%20define%20%3demployee%20class%20%20map%3b’));
</server>
return = atp.formatMoney(format, amount)
This function formats a number according to local currency conventions. The format
parameter follows the conventions used by the C language library strfmon() routine.
In ATP the format parameter is ignored. The format of the result has two places after
the decimal point and contains no commas; for example, if you supplied the amount
2345, the function would return the value 2345.00.