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!

Undefined - What????

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Guys,

I have a client side function running which checks the contents of a select box and uses the choice to generate table HTML code. It then uses document.write to output the code to the browser. However, I always get the word "undefined" appearing just above the table. Can anyone please tell me what would cause this. I have enclosed a excerpt of the function below:

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
function showStockLevels(form) {
var tableStart;
var tableRow;
var tableEnd;
var tableHTML;
var parts=new Array(415);
for (i=0; i<415; i++) { parts = new Array(2); }

tableStart='<TABLE BORDER=&quot;1&quot; CELLSPACING=&quot;0&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>';
parts[3][0]='02000105';
parts[3][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[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[1];
}
}
}

tableEnd='</TABLE><CENTER><p><a href=&quot;javascript:history.back()&quot;><-- Back</a>';
tableHTML=tableStart+tableRow+tableEnd;
document.write(tableHTML)
}
//-->
</SCRIPT>
Mise Le Meas,

Mighty :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top