Array Manipulation


Below is a complex chunk of code which stores a series of records in an array, and displays the data in a frameset. Run the Trouble Ticket Sample Application to see this run in its full glory.

var loc51=6;
var loc52=9;
var prev1=0;
var prev2=0;

/*-----------------------------------------------------------------------*/
array1 = new Array(
"01000 010 1122334 EQUITY MANAGER A      DFED123 DOS 6.22 INSTALL       Pending   FINANCE",
"01132 006 1122335 EQUITY MANAGER B      EFGH456 CISCO ROUTER           Reopened  FINANCE",
"05444 040 1122336 EQUITY MANAGER C      IJKL789 PC ANYWHERE            Resolved  LEGAL",
"05454 002 6843332 CENTRAL SOUTH         CAPT372 LOTUS 123 V3           Research  FINANCE",
"10292 022 0123272 PRIME SYSTEMS         PARA622 PARADIGM SYSCONFIG     Closed    DEPT T4",
"11212 024 0434332 ZEN SYSTEMS           CXFS933 CROSSWORLD CONFIG      Pending   BANK DEPT");

var role_cd="X";

/*-------------------------------------------------------------*/
/* writecell: write data to selection frame, middle right      */
/*-------------------------------------------------------------*/
function f_writecell(rdata)
{
   parent.fra_tttsel33.document.write('<td align="left"><small>');
   parent.fra_tttsel33.document.write(rdata);
   parent.fra_tttsel33.document.write('</small></td>');
}
function f_writecell_lb(rdata)
{
   parent.fra_tttsel33.document.write('<td><small><select>');
   if (role_cd=='R') {
    parent.fra_tttsel33.document.write('<option selected>' + rdata +
    '<option>Pending' +
    '<option>Resolved' +
    '<option>Research');
   } else {
    parent.fra_tttsel33.document.write('<option selected>' + rdata +
    '<option>Pending' +
    '<option>Reopened' +
    '<option>Closed');
   }
   parent.fra_tttsel33.document.write('</select></small></td>');
}
/*---------------------------------------------------------------*/
/* zoom: open proto response window                      */
/*---------------------------------------------------------------*/
function f_zoom(parm1)
{
    w_tttedit = window.open("ttteditb.html","w_tttedit",
    "toolbar=0,menubar=0,location=0,status=0,height=460,width=470") ;
    w_tttedit.inq_id = parm1 ;
}
/*-------------------------------------------------------------*/
/* sort: sort data array, call cell writer for each row        */
/*-------------------------------------------------------------*/
function f_sort(parm1)
{
if (parm1>0) {
  eval("array1.sort(f_compare" + parm1 + ");");
  eval("prev1=loc" + parm1 + "1;");
  eval("prev1=loc" + parm1 + "2;");
  }

parent.fra_tttsel33.document.open();
parent.fra_tttsel33.document.write('<html><body><form><table border=0 width="150%">');

parent.fra_tttsel33.document.write('<td width=4%></td>');
parent.fra_tttsel33.document.write('<td width=5%></td>');
parent.fra_tttsel33.document.write('<td width=4%></td>');
parent.fra_tttsel33.document.write('<td width=7%></td>');
parent.fra_tttsel33.document.write('<td width=25%></td>');
parent.fra_tttsel33.document.write('<td width=10%></td>');
parent.fra_tttsel33.document.write('<td width=8%></td>');
parent.fra_tttsel33.document.write('<td width=*></td>');
parent.fra_tttsel33.document.write('</tr>');

for (i=0;i<array1.length;i++)
   {
   f_writecell("<input type='checkbox'>");
   f_writecell("<a href='javascript: parent.fra_tttsel32.f_zoom(" +'"' + array1[i].substring(loc11,loc12) + '"' +")'>" + array1[i].substring(loc11,loc12) + "</a>");
   f_writecell(array1[i].substring(loc51,loc52));
   f_writecell(array1[i].substring(loc21,loc22));
   f_writecell(array1[i].substring(loc31,loc32));
   f_writecell_lb(array1[i].substring(loc41,loc42));
   f_writecell(array1[i].substring(39,47));
   f_writecell(array1[i].substring(48,71));
   parent.fra_tttsel33.document.write('</tr>');
   }
parent.fra_tttsel33.document.write('</form></table></body></html>');
parent.fra_tttsel33.document.close();
}
/*===================================================================*/
function f_help()
{
    w_tttedit = window.open("tttabout.html","w_tttabout",
       "toolbar=0,menubar=0,location=0,status=0,height=430,width=300")
}
/*===================================================================*/




Back to top
Bar and Restaurant Guide
email ... js99@rocket99.com

Copyright 1998-2000 © Citisoft, Inc. All Rights Reserved.