Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array Problem

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Guys,

I don't really have any JS reference and I am trying to use references on the web. But I can't find any good reference on multi-dimensional arrays. I have a fraction of my code below and I am getting the following JS error:

Line: 11
Char: 3
Error: Function Expected

<HTML>
<HEAD>
<TITLE>Stock Query Sample</TITLE>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
function showStockLevels(form,Theobj) {
var tableStart;
var tableRow;
var tableEnd;
var tableHTML;
var parts=new Array()(); //Line 11

tableStart='<TABLE BORDER=&quot;1&quot; CELLSPACING=&quot;0&quot; BORDERCOLOR=&quot;BLUE&quot; ALIGN=&quot;CENTER&quot; CELLPADDING=&quot;3&quot;><TR><TH ALIGN=&quot;CENTER&quot;>Part ID</TH><TH ALIGN=&quot;CENTER&quot;>Part Description</TH><TH ALIGN=&quot;CENTER&quot;>quantity</TH></TR>';

parts(0)(0)='01001102';
parts(0)(1)='<TR><TD ALIGN=&quot;CENTER&quot;>01001102</TD><TD ALIGN=&quot;CENTER&quot;>CLEAR 6&quot; PVC TUBE</TD><TD ALIGN=&quot;CENTER&quot;>0</TD></TR>';
parts(1)(0)='01002401';
parts(1)(1)='<TR><TD ALIGN=&quot;CENTER&quot;>01002401</TD><TD ALIGN=&quot;CENTER&quot;>GREEN STRIPPED PVC6&quot;TUBE</TD><TD ALIGN=&quot;CENTER&quot;>0</TD></TR>';
parts(2)(0)='02000105';
parts(2)(1)='<TR><TD ALIGN=&quot;CENTER&quot;>02000105</TD><TD ALIGN=&quot;CENTER&quot;>POUCH 8&quot;X15&quot;</TD><TD ALIGN=&quot;CENTER&quot;>0</TD></TR>';

if (form.selectbox.value!=&quot;&quot;) {
var mySelect = form.selectbox;
for(i=0;i<mySelect.length;i++){
if(mySelect.options(i).selected){
tableRow=tableRow + parts(i)(1);
}
}
}
else {
for(i=0;i<parts.length;i++){
if (parts(i)(0) >= form.rangestart.value && parts(i)(0) <= form.rangeend.value) {
tableRow=tableRow + parts(i)(1);
}
}
}

tableEnd=&quot;</TABLE>&quot;;
tableHTML=tableStart+tableRow+tableEnd;
document.all[Theobj].insertAdjacentHTML('BeforeEnd',tableHTML);
}
//-->
</SCRIPT>
</HEAD>

Any help you can give me would be greatly appreciated. It's most likely just a syntax error on my part.
Mise Le Meas,

Mighty :)
 
this is copied pasted from devedge

Two-Dimensional Arrays
The following code creates a two-dimensional array.

a = new Array(4)for (i=0; i < 4; i++) { a = new Array(4) for (j=0; j < 4; j++) { a[j] = &quot;[&quot;+i+&quot;,&quot;+j+&quot;]&quot; }}
The following code displays the array:

for (i=0; i < 4; i++) { str = &quot;Row &quot;+i+&quot;:&quot; for (j=0; j < 4; j++) { str += a[j] } document.write(str,&quot;<p>&quot;)}


and this is the url
 
iza,

Thanks for the input. I had eventually found the same code myself. Maybe I should have replied to my own post to let people know. Mise Le Meas,

Mighty :)
 
you definitly should have !!!!!! i mean, this is a forum, and imagine if somebody had the same problem as you do - (s)he might think (s)he'll get the answer here ... and finds a non answered question .... well, i'm sure YOU wouldn't like this ( *i* wouldn't !!)
but i'm happy you solved your problem !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top