S
Suzanne Saville
The code is below. I've tried many things but I need to reverse the
array, and also in the message is it contains an & # % it cuts the
rest of the message off. Please help.
JS included script
------------------
// *** Start of Server-inserted script ***
function getURL () { return '<CTX_VAL URL>'; }
function getImageRoot () { return '<CTX_VAL ImageRoot>'; }
function getDocRoot () { return '<CTX_VAL DocRoot>'; }
function doPost ( pageFmt, cmdFmt ) { window.location.replace (
getURL() + pageFmt + cmdFmt ); }
arryUnicode = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8",
"9", "A", "B", "C", "D", "E", "F");
function doConvertUnicode(code) {
d = parseInt(code / 16, 10);
m = code % 16;
return "00" + arryUnicode[d] + arryUnicode[m];
}
// format arguments from an array (such as an argument list).
//Offset and length specify
// where, in the args array, to start and how many to use.
function formatArgs ( argPrefix, args, offset, length )
{
var argText = '';
for (var i=0; i<length; i++) {
var newvalue = "";
for (var j=0; j<args[offset+i].length; j++) {
if (args[offset+i].charCodeAt(j) > 127 ||
args[offset+i].charCodeAt(j) < 30) {
newvalue += "\\u" +
doConvertUnicode(args[offset+i].charCodeAt(j));
}
else {
newvalue += args[offset+i].charAt(j);
}
}
args[offset+i] = newvalue;
argText += argPrefix + (i+1) + '=' + args[offset+i];
}
return argText;
}
function formatPageArgs ( args, offset, length ) { return formatArgs (
'&pa', args, offset, length ); }
function formatCmdArgs ( args, offset, length ) { return formatArgs (
'&ca', args, offset, length ); }
function jPage ( page ) { return '&pi=' + page + formatPageArgs (
jPage.arguments,1, jPage.arguments.length-1 ); }
function jCmd ( cmd ) { return '&ci=' + cmd + formatCmdArgs (
jCmd.arguments,1, jCmd.arguments.length-1 ); }
function formatPage ( page, formattedArgs ) { return '&pi=' + page +
formattedArgs; }
function formatCmd ( cmd, formattedArgs ) { return '&ci=' + cmd +
formattedArgs; }
// Requests a new page. Arguments following "page" are used as page
arguments.
function newPage ( page ) { doPost ( formatPage ( page, formatPageArgs
( newPage.arguments,1, newPage.arguments.length-1 ) ), '' ); }
// Issues a command, formatted per formatCmd.
function doFormattedCommand ( formattedCmd ) { doPost ( '',
formattedCmd ); }
// Issues a command. Arguments following "cmd" are used as command
arguments.
function doCommand ( cmd )
{
doPost ( '', formatCmd ( cmd, formatCmdArgs ( doCommand.arguments,
1, doCommand.arguments.length-1 ) ) );
}
// Issues a command AND requests a new page. No page arguments are
permitted.
// Arguments following "cmd" are used as command arguments.
function doCmdAndNewPage ( page, cmd )
{
var formattedArgs = formatCmdArgs ( doCmdAndNewPage.arguments, 2,
doCmdAndNewPage.arguments.length-2 );
doPost ( jPage ( page ), formatCmd ( cmd, formattedArgs ) );
}
Program call
------------
function doSendMsgAll() {
var args = new Array();
with(document.chatForm) {
args[0] = newMsg.value;
}
doFormattedCommand( formatCmd( 'SendMsg', formatCmdArgs( args, 0,
args.length)));
}
array, and also in the message is it contains an & # % it cuts the
rest of the message off. Please help.
JS included script
------------------
// *** Start of Server-inserted script ***
function getURL () { return '<CTX_VAL URL>'; }
function getImageRoot () { return '<CTX_VAL ImageRoot>'; }
function getDocRoot () { return '<CTX_VAL DocRoot>'; }
function doPost ( pageFmt, cmdFmt ) { window.location.replace (
getURL() + pageFmt + cmdFmt ); }
arryUnicode = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8",
"9", "A", "B", "C", "D", "E", "F");
function doConvertUnicode(code) {
d = parseInt(code / 16, 10);
m = code % 16;
return "00" + arryUnicode[d] + arryUnicode[m];
}
// format arguments from an array (such as an argument list).
//Offset and length specify
// where, in the args array, to start and how many to use.
function formatArgs ( argPrefix, args, offset, length )
{
var argText = '';
for (var i=0; i<length; i++) {
var newvalue = "";
for (var j=0; j<args[offset+i].length; j++) {
if (args[offset+i].charCodeAt(j) > 127 ||
args[offset+i].charCodeAt(j) < 30) {
newvalue += "\\u" +
doConvertUnicode(args[offset+i].charCodeAt(j));
}
else {
newvalue += args[offset+i].charAt(j);
}
}
args[offset+i] = newvalue;
argText += argPrefix + (i+1) + '=' + args[offset+i];
}
return argText;
}
function formatPageArgs ( args, offset, length ) { return formatArgs (
'&pa', args, offset, length ); }
function formatCmdArgs ( args, offset, length ) { return formatArgs (
'&ca', args, offset, length ); }
function jPage ( page ) { return '&pi=' + page + formatPageArgs (
jPage.arguments,1, jPage.arguments.length-1 ); }
function jCmd ( cmd ) { return '&ci=' + cmd + formatCmdArgs (
jCmd.arguments,1, jCmd.arguments.length-1 ); }
function formatPage ( page, formattedArgs ) { return '&pi=' + page +
formattedArgs; }
function formatCmd ( cmd, formattedArgs ) { return '&ci=' + cmd +
formattedArgs; }
// Requests a new page. Arguments following "page" are used as page
arguments.
function newPage ( page ) { doPost ( formatPage ( page, formatPageArgs
( newPage.arguments,1, newPage.arguments.length-1 ) ), '' ); }
// Issues a command, formatted per formatCmd.
function doFormattedCommand ( formattedCmd ) { doPost ( '',
formattedCmd ); }
// Issues a command. Arguments following "cmd" are used as command
arguments.
function doCommand ( cmd )
{
doPost ( '', formatCmd ( cmd, formatCmdArgs ( doCommand.arguments,
1, doCommand.arguments.length-1 ) ) );
}
// Issues a command AND requests a new page. No page arguments are
permitted.
// Arguments following "cmd" are used as command arguments.
function doCmdAndNewPage ( page, cmd )
{
var formattedArgs = formatCmdArgs ( doCmdAndNewPage.arguments, 2,
doCmdAndNewPage.arguments.length-2 );
doPost ( jPage ( page ), formatCmd ( cmd, formattedArgs ) );
}
Program call
------------
function doSendMsgAll() {
var args = new Array();
with(document.chatForm) {
args[0] = newMsg.value;
}
doFormattedCommand( formatCmd( 'SendMsg', formatCmdArgs( args, 0,
args.length)));
}