I have this array which is given to me by the cgi and they wanted me to control the display in such a way that only 10 records are shown at a time and provide PREVIOUS and NEXT buttons. I need help on this one, I'm not familiar with array manipulation and how I can limit the display on screen and how the PREVIOUS and NEXT button would display the first 10 and next 10 and so on.
Any help is appreciated.
<script language="javascript">
myAlign = new Array('left','left', 'left','left','left');
myWidth = new Array(100,150,150,200,200);
myDetail = new Array(
new Array('sad','d','sha','Wed Jun 25 13:59:31 2003','Wed Oct 1 00:00:00 2003'),
new Array('sandra','dy','sandra2','Wed Jun 25 14:23:12 2003','Sat Jan 1 00:00:00 2005'),
new Array('eu_ric_m','d','ric','Fri Jun 27 11:31:53 2003','Wed Oct 1 00:00:00 2003'),
new Array('su_ric_m','d','ric','Fri Jun 27 11:42:55 2003','Sat Nov 1 00:00:00 2003'),
new Array('eu_ric_m2','d','ric','Fri Jun 27 13:57:52 2003','Sat Nov 1 00:00:00 2003'),
new Array('shanghai_end','last','first','Fri Jun 27 17:43:32 2003','Thu Jan 1 00:00:00 2004'),
new Array('usr0630-1','usr0630-1','usr0630-1','Mon Jun 30 11:40:08 2003','Thu Dec 1 00:00:00 2022'),
new Array('testingric','d','ric','Mon Jun 30 17:14:54 2003','Wed Oct 1 00:00:00 2003'),
new Array('eller_d333','r','ric','Mon Jun 30 17:25:12 2003','Fri Aug 1 00:00:00 2003'),
new Array('shaunp','patrick','shaun','Tue Jul 1 14:31:17 2003','Sat Jan 1 00:00:00 2011'),
new Array('shaunp2','patrick','shaun','Tue Jul 1 14:33:35 2003','Sat Jan 1 00:00:00 2011'),
new Array('shaunp3','patrick','shaun','Tue Jul 1 14:35:25 2003','Sat Jan 1 00:00:00 2011'),
new Array('vca_test101','123','l123','Tue Jul 1 19:46:47 2003','Thu Feb 1 00:00:00 2018'),
'END');
// This is my function where I display the data onto the screen.
function display()
{
var str = '<div align="center"><table id="tabBody" border="0" bgcolor="#000000" text="#CCCCFF" align="center" cellpadding="0" cellspacing="0">'
for (var row in myDetail)
{
i += 1
str += '<tr>'
for (var col in myDetail[row])
{
no = myDetail[row][col]
if (no == null || no == '')
no = ' '
else if (col == 0)
{
str += '<td align="'+ myAlign[col] +'" width="' + myWidth[col] + '">'
str += ' <font size=1>' + no + '>'
str += '</font></td>'
}
else if (col !=0)
{
str += '<td align="'+myAlign[col]+'" width="'+myWidth[col] + '">'
str += '<font size=1>' + no + '</font></td>'
}
}
str += '</tr>'
}
str += '<tr><td colspan="9" align="center"> </td></tr>'
str += '<tr><td colspan="9" align="center">'
str += '<div align="center">'
str += '</div></td></tr>'
str += '</table></div>'
}
</script>
Any help is appreciated.
<script language="javascript">
myAlign = new Array('left','left', 'left','left','left');
myWidth = new Array(100,150,150,200,200);
myDetail = new Array(
new Array('sad','d','sha','Wed Jun 25 13:59:31 2003','Wed Oct 1 00:00:00 2003'),
new Array('sandra','dy','sandra2','Wed Jun 25 14:23:12 2003','Sat Jan 1 00:00:00 2005'),
new Array('eu_ric_m','d','ric','Fri Jun 27 11:31:53 2003','Wed Oct 1 00:00:00 2003'),
new Array('su_ric_m','d','ric','Fri Jun 27 11:42:55 2003','Sat Nov 1 00:00:00 2003'),
new Array('eu_ric_m2','d','ric','Fri Jun 27 13:57:52 2003','Sat Nov 1 00:00:00 2003'),
new Array('shanghai_end','last','first','Fri Jun 27 17:43:32 2003','Thu Jan 1 00:00:00 2004'),
new Array('usr0630-1','usr0630-1','usr0630-1','Mon Jun 30 11:40:08 2003','Thu Dec 1 00:00:00 2022'),
new Array('testingric','d','ric','Mon Jun 30 17:14:54 2003','Wed Oct 1 00:00:00 2003'),
new Array('eller_d333','r','ric','Mon Jun 30 17:25:12 2003','Fri Aug 1 00:00:00 2003'),
new Array('shaunp','patrick','shaun','Tue Jul 1 14:31:17 2003','Sat Jan 1 00:00:00 2011'),
new Array('shaunp2','patrick','shaun','Tue Jul 1 14:33:35 2003','Sat Jan 1 00:00:00 2011'),
new Array('shaunp3','patrick','shaun','Tue Jul 1 14:35:25 2003','Sat Jan 1 00:00:00 2011'),
new Array('vca_test101','123','l123','Tue Jul 1 19:46:47 2003','Thu Feb 1 00:00:00 2018'),
'END');
// This is my function where I display the data onto the screen.
function display()
{
var str = '<div align="center"><table id="tabBody" border="0" bgcolor="#000000" text="#CCCCFF" align="center" cellpadding="0" cellspacing="0">'
for (var row in myDetail)
{
i += 1
str += '<tr>'
for (var col in myDetail[row])
{
no = myDetail[row][col]
if (no == null || no == '')
no = ' '
else if (col == 0)
{
str += '<td align="'+ myAlign[col] +'" width="' + myWidth[col] + '">'
str += ' <font size=1>' + no + '>'
str += '</font></td>'
}
else if (col !=0)
{
str += '<td align="'+myAlign[col]+'" width="'+myWidth[col] + '">'
str += '<font size=1>' + no + '</font></td>'
}
}
str += '</tr>'
}
str += '<tr><td colspan="9" align="center"> </td></tr>'
str += '<tr><td colspan="9" align="center">'
str += '<div align="center">'
str += '</div></td></tr>'
str += '</table></div>'
}
</script>