...

View Full Version : sooo slow



gingerGamgee
01-08-2004, 12:12 AM
I copied the quadrouple combobox code off another thread...I added two more boxes, but I am having problems.

First of all it takes sooo long to load.
Next, I get an error on the fifth combo box. I deleted some of the options for the combo boxes because I am going to fill in my own. I'm not sure if that would affect it or not.

I had the fifth box working perfectly untill I added the sixth box.
I am sure it is something simple I am just not seeing it.

Oh, and I was also wondering....at the end of my script I have an alert message reporting the Option Values that have been choosen. Can I turn that into regular text on the page instead?

Thanks All!

<html>
<head>
<title>DROP TEST</title>
</head>
<body>

<FORM name="CBN">
<table border="0" cellspacing="0" cellpadding="0">

<td nowrap height="11">
<select name="CBN1" size="1"
onChange="ReDirect1(this.options.selectedIndex)">
<option selected>---Select Base Commodity-------------</option>
<option value="S">Steel</option>
<option value ="P">Perishable</option>
<option value ="G">Glass</option>
<option value ="E">Electrical</option>
<option value "W">Wiper Motors and Accessories</option>

</select>

<select name="CBN2" size="1"
onChange="ReDirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select Type--------------</option>
<option value=" " selected>---Select Type--------------</option>
</select>
<select name="CBN3" size="1"
onChange="ReDirect3(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select Group----------------</option>
<option value=" " selected>---Select Group----------------</option>
</select>
<select name="CBN4" size="1"
onChange="ReDirect4(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select Grade----------------</option>
<option value=" " selected>---Select Grade----------------</option>
</select>
<select name="CBN5" size="1"
onChange="ReDirect5(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select Finish----------------</option>
<option value=" " selected>---Select Finish----------------</option>
</select>
<select name="CBN6" size="1"
onChange="ReDirect6(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select Finish----------------</option>
<option value=" " selected>---Select Finish----------------</option>
</select>
<script>
<!--

/* */
var temp=document.CBN.CBN2
var temp1=document.CBN.CBN3
var temp2=document.CBN.CBN4
var temp3=document.CBN.CBN5
var temp4=document.CBN.CBN6
var CB2=document.CBN.CBN1.options.length
var CB3=document.CBN.CBN2.options.length
var CB4=document.CBN.CBN3.options.length
var CB5=document.CBN.CBN4.options.length
var CB6=document.CBN.CBN5.options.length
var ComboBox2=new Array(CB2)
var ComboBox3=new Array(CB2)
var ComboBox4=new Array(CB2)
var ComboBox5=new Array(CB2)
var ComboBox6=new Array(CB2)
var maximum="12"
var max=eval(maximum-1)
/* */

for (a=0; a<=max; a++){
ComboBox2[a]=new Array()
}
for (b=0; b<=max; b++){
ComboBox3[b]=new Array()
for (c=0; c<=max; c++){
ComboBox3[b][c]=new Array()
}}
for (d=0; d<=max; d++){
ComboBox4[d]=new Array()
for (e=0; e<=max; e++){
ComboBox4[d][e]=new Array()
for (f=0;f<=max; f++){
ComboBox4[d][e][f]=new Array()
}}}
for (g=0; g<=max; g++){
ComboBox5[g]=new Array()
for (h=0; h<=max; h++){
ComboBox5[g][h]=new Array()
for (i=0; i<=max; i++){
ComboBox5[g][h][i]=new Array()
for (j=0; j<=max; j++){
ComboBox5[g][h][i][j]=new Array()
}}}}
for (k=0; k<=max; k++){
ComboBox6[k]=new Array()
for (l=0; l<=max; l++){
ComboBox6[k][l]=new Array()
for (n=0; n<=max; n++){
ComboBox6[k][l][n]=new Array()
for (p=0; p<=max; p++){
ComboBox6[k][l][n][p]=new Array()
for (q=0; q<=max; q++){
ComboBox6[k][l][n][p][q]=new Array()
}}}}}


ComboBox2[0][0]=new Option("---Select Type---"," ");
ComboBox2[1][0]=new Option("Now Select Type"," ");
ComboBox2[1][1]=new Option("Flat","F");
ComboBox2[1][2]=new Option("Tube","T");
ComboBox2[1][3]=new Option("Bar","B");

ComboBox2[2][0]=new Option("Now Select Type"," ");



ComboBox3[0][0][0]=new Option("---Select Group---"," ");
ComboBox3[1][0][0]=new Option("---Select Group---"," ");
ComboBox3[1][1][0]=new Option("Now Select Group"," ");
ComboBox3[1][1][1]=new Option("Plate","P");
ComboBox3[1][1][2]=new Option("Sheet","S");
ComboBox3[1][1][3]=new Option("Mesh","M");
ComboBox3[1][1][4]=new Option("Checker","C");

ComboBox3[1][2][0]=new Option("Now Select Group"," ");


ComboBox3[2][0][0]=new Option("---Select 3---"," ");
ComboBox3[2][1][0]=new Option("Now Select Group"," ");

ComboBox3[2][2][0]=new Option("Now Select Group"," ");



ComboBox4[0][0][0][0]=new Option("---Select ---"," ");
ComboBox4[1][0][0][0]=new Option("---Select ---"," ");
ComboBox4[1][1][1][0]=new Option("Now Select Grade"," ");
ComboBox4[1][1][1][1]=new Option("Mild","M");
ComboBox4[1][1][1][2]=new Option("Rops","R");
ComboBox4[1][1][1][3]=new Option("SS","S");

ComboBox4[2][0][0][0]=new Option("---Select ---"," ");


ComboBox5[0][0][0][0][0]=new Option("---Select ---"," ");
ComboBox5[1][0][0][0][0]=new Option("---Select ---"," ");
ComboBox5[1][1][0][0][0]=new Option("---Select ---"," ");
ComboBox5[1][1][1][0][0]=new Option("Now Select Finish"," ");
ComboBox5[1][1][1][1][0]=new Option("Now Select Finish"," ");
ComboBox5[1][1][1][1][1]=new Option("P&O","P");
ComboBox5[1][1][1][1][2]=new Option("Dry","D");
ComboBox5[1][1][1][1][3]=new Option("Blast","B");


ComboBox6[0][0][0][0][0][0]=new Option("---Select ---"," ");
ComboBox6[1][0][0][0][0][0]=new Option("---Select ---"," ");
ComboBox6[1][1][1][1][0][0]=new Option("Now Select Traceablity"," ");
ComboBox6[1][1][1][1][1][1]=new Option("Yes","Y");
ComboBox6[1][1][1][1][1][2]=new Option("No","N");

/* */
function ReDirect1(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<ComboBox2[x].length;i++){
temp.options[i]=new Option(ComboBox2[x][i].text,ComboBox2[x][i].value)
}
temp.options[0].selected=true
ReDirect2(0)
}
function ReDirect2(y){
var x=document.CBN.CBN1.options.selectedIndex
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<ComboBox3[x][y].length;i++){
temp1.options[i]=new Option(ComboBox3[x][y][i].text,ComboBox3[x][y][i].value)
}
temp1.options[0].selected=true
ReDirect3(0)
}
function ReDirect3(z){
var x=document.CBN.CBN1.options.selectedIndex
var y=document.CBN.CBN2.options.selectedIndex
for (m=temp2.options.length-1;m>0;m--)
temp2.options[m]=null
for (i=0;i<ComboBox4[x][y][z].length;i++){
temp2.options[i]=new Option(ComboBox4[x][y][z][i].text,ComboBox4[x][y][z][i].value)
}
temp2.options[0].selected=true
ReDirect4(0)
}
function ReDirect4(a){
var x=document.CBN.CBN1.options.selectedIndex
var y=document.CBN.CBN2.options.selectedIndex
var z=document.CBN.CBN3.options.selectedIndex
for (m=temp3.options.length-1;m>0;m--)
temp3.options[m]=null
for (i=0;i<ComboBox5[x][y][z][a].length;i++){
temp3.options[i]=new Option(ComboBox5[x][y][z][a][i].text,ComboBox5[x][y][z][a][i].value)
}
temp3.options[0].selected=true
ReDirect5(0)
}
function ReDirect5(b)
{
var x=document.CBN.CBN1.options.selectedIndex
var y=document.CBN.CBN2.options.selectedIndex
var z=document.CBN.CBN3.options.selectedIndex
var a=document.CBN.CBN4.options.selectedIndex
for (m=temp4.options.length-1;m>0;m--)
temp4.options[m]=null
for (i=0;i<ComboBox6[x][y][z][a][b].length;i++){
temp4.options[i]=new Option(ComboBox6[x][y][z][a][b][i].text,ComboBox6[x][y][z][a][b][i].value)
}
temp4.options[0].selected=true
}

function ReDirect6(c)
{
d = document.forms[0];
alert(d.CBN1.value + d.CBN2.value);
}
//-->
</script>

</td>
</tr>
</table>
</FORM>


</font>
</p>

</body>
</html>

gingerGamgee
01-09-2004, 11:29 PM
Well, I ended up taking the sixth box off and now every thing works perfectly. I really wish I could have that sixth box, but if any one can get it to work, let me know!! Here is the code for 5 linked drop down boxes. ( the "yes" "no" box is free, not linked to the others) Some of the values are not completed but you get the idea.





<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>DROP TEST</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY>
<FORM name=CBN>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD noWrap height=11><SELECT
onchange=ReDirect1(this.options.selectedIndex) size=1 name=CBN1> <OPTION
selected>---Select Base Commodity-------------</OPTION> <OPTION
value=S>Steel</OPTION> <OPTION value=P>Perishable</OPTION> <OPTION
value=G>Glass</OPTION> <OPTION value=E>Electrical</OPTION> <OPTION
value="" ?W?>Wiper Motors and Accessories</OPTION></SELECT> Traceable?
<SELECT size=1 ?CBN6?> <OPTION value=" " selected></OPTION> <OPTION
value=Y>Yes</OPTION> <OPTION value=N>No</OPTION></SELECT>
<P><SELECT onchange=ReDirect2(this.options.selectedIndex) size=1
name=CBN2> <OPTION value=" "></OPTION> <OPTION value=" ">---Select
Type--------------</OPTION> <OPTION value=" " selected>---Select
Type--------------</OPTION></SELECT>
<P><SELECT onchange=ReDirect3(this.options.selectedIndex) size=1
name=CBN3> <OPTION value=" "></OPTION> <OPTION value=" ">---Select
Group----------------</OPTION> <OPTION value=" " selected>---Select
Group----------------</OPTION></SELECT>
<P><SELECT onchange=ReDirect4(this.options.selectedIndex) size=1
name=CBN4> <OPTION value=" "></OPTION> <OPTION value=" ">---Select
Grade----------------</OPTION> <OPTION value=" " selected>---Select
Grade----------------</OPTION></SELECT>
<P><SELECT onchange=ReDirect5(this.options.selectedIndex) size=1
name=CBN5> <OPTION value=" "></OPTION> <OPTION value=" ">---Select
Finish----------------</OPTION> <OPTION value=" " selected>---Select
Finish----------------</OPTION></SELECT>
<P><INPUT readOnly name=alerthere>
<SCRIPT>
<!--

/* */
var temp=document.CBN.CBN2
var temp1=document.CBN.CBN3
var temp2=document.CBN.CBN4
var temp3=document.CBN.CBN5


var CB2=document.CBN.CBN1.options.length
var CB3=document.CBN.CBN2.options.length
var CB4=document.CBN.CBN3.options.length
var CB5=document.CBN.CBN4.options.length


var ComboBox2=new Array(CB2)
var ComboBox3=new Array(CB2)
var ComboBox4=new Array(CB2)
var ComboBox5=new Array(CB2)

var maximum="12"
var max=eval(maximum-1)
/* */

for (a=0; a<=max; a++){
ComboBox2[a]=new Array()
}
for (b=0; b<=max; b++){
ComboBox3[b]=new Array()
for (c=0; c<=max; c++){
ComboBox3[b][c]=new Array()
}}
for (d=0; d<=max; d++){
ComboBox4[d]=new Array()
for (e=0; e<=max; e++){
ComboBox4[d][e]=new Array()
for (f=0;f<=max; f++){
ComboBox4[d][e][f]=new Array()
}}}
for (g=0; g<=max; g++){
ComboBox5[g]=new Array()
for (h=0; h<=max; h++){
ComboBox5[g][h]=new Array()
for (r=0; r<=max; r++){
ComboBox5[g][h][r]=new Array()
for (j=0; j<=max; j++){
ComboBox5[g][h][r][j]=new Array()
}}}}



ComboBox2[0][0]=new Option("---Select Type---"," ");
ComboBox2[1][0]=new Option("Now Select Type"," ");
ComboBox2[1][1]=new Option("Flat","F");
ComboBox2[1][2]=new Option("Tube","T");
ComboBox2[1][3]=new Option("Bar","B");

ComboBox3[0][0][0]=new Option("---Select Group---"," ");
ComboBox3[1][0][0]=new Option("---Select Group---"," ");
ComboBox3[1][1][0]=new Option("Now Select Group"," ");
ComboBox3[1][1][1]=new Option("Plate","P");
ComboBox3[1][1][2]=new Option("Sheet","S");
ComboBox3[1][1][3]=new Option("Mesh","M");
ComboBox3[1][1][4]=new Option("Checker","C");

ComboBox3[1][2][0]=new Option("Now Select Group"," ");
ComboBox3[1][2][1]=new Option("RD","R");
ComboBox3[1][2][2]=new Option("SQ","SQ");
ComboBox3[1][2][3]=new Option("Shape","S");
ComboBox3[1][2][4]=new Option("Pipe","P");

ComboBox3[1][3][0]=new Option("Now Select Group");
ComboBox3[1][3][1]=new Option("RD","R");
ComboBox3[1][3][2]=new Option("SQ","SQ");
ComboBox3[1][3][3]=new Option("Flat","F");
ComboBox3[1][3][4]=new Option("Misc","M");


ComboBox4[0][0][0][0]=new Option("---Select ---"," ");
ComboBox4[1][0][0][0]=new Option("---Select ---"," ");
ComboBox4[1][1][1][0]=new Option("Now Select Grade"," ");
ComboBox4[1][1][1][1]=new Option("Mild","M");
ComboBox4[1][1][1][2]=new Option("Rops","R");
ComboBox4[1][1][1][3]=new Option("SS","S");

ComboBox4[1][2][1][0]=new Option("Now Select Grade"," ");
ComboBox4[1][2][1][1]=new Option("Mild","M");
ComboBox4[1][2][1][2]=new Option("Rops","R");
ComboBox4[1][2][1][3]=new Option("SS","S");




ComboBox4[2][0][0][0]=new Option("---Select ---"," ");


ComboBox5[0][0][0][0][0]=new Option("---Select ---"," ");
ComboBox5[1][0][0][0][0]=new Option("---Select ---"," ");
ComboBox5[1][1][0][0][0]=new Option("---Select ---"," ");
ComboBox5[1][1][1][0][0]=new Option("---Select ---"," ");
ComboBox5[1][1][1][1][0]=new Option("Now Select Finish"," ");
ComboBox5[1][1][1][1][1]=new Option("P&O","P");
ComboBox5[1][1][1][1][2]=new Option("Dry","D");
ComboBox5[1][1][1][1][3]=new Option("Blast","B");

ComboBox5[1][1][2][0][0]=new Option("Now Select A Page"," ");

ComboBox2[2][0]=new Option("Now Select Type"," ");

ComboBox3[2][0][0]=new Option("---Select 3---"," ");
ComboBox3[2][1][0]=new Option("Now Select Group"," ");

ComboBox3[2][2][0]=new Option("Now Select Group"," ");



/* */
function ReDirect1(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<ComboBox2[x].length;i++){
temp.options[i]=new Option(ComboBox2[x][i].text,ComboBox2[x][i].value)
}
temp.options[0].selected=true
ReDirect2(0)
}
function ReDirect2(y){
var x=document.CBN.CBN1.options.selectedIndex
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<ComboBox3[x][y].length;i++){
temp1.options[i]=new Option(ComboBox3[x][y][i].text,ComboBox3[x][y][i].value)
}
temp1.options[0].selected=true
ReDirect3(0)
}
function ReDirect3(z){
var x=document.CBN.CBN1.options.selectedIndex
var y=document.CBN.CBN2.options.selectedIndex
for (m=temp2.options.length-1;m>0;m--)
temp2.options[m]=null
for (i=0;i<ComboBox4[x][y][z].length;i++){
temp2.options[i]=new Option(ComboBox4[x][y][z][i].text,ComboBox4[x][y][z][i].value)
}
temp2.options[0].selected=true
ReDirect4(0)
}
function ReDirect4(a){
var x=document.CBN.CBN1.options.selectedIndex
var y=document.CBN.CBN2.options.selectedIndex
var z=document.CBN.CBN3.options.selectedIndex
for (m=temp3.options.length-1;m>0;m--)
temp3.options[m]=null
for (i=0;i<ComboBox5[x][y][z][a].length;i++){
temp3.options[i]=new Option(ComboBox5[x][y][z][a][i].text,ComboBox5[x][y][z][a][i].value)
}
temp3.options[0].selected=true
ReDirect5(0)
}
function ReDirect5(b)
{
d = document.getElementsByTagName('select');
dd="";
for(i=0;i<d.length;i++){
dd = dd+d[i].value;
}
document.forms[0].alerthere.value = dd;

}



//-->
</SCRIPT>
</P></TD></TR></TBODY></TABLE></FORM></FONT>
<P></P></BODY></HTML>

beetle
01-09-2004, 11:47 PM
QForms, a great javascript forms API, allows you to create n-related select lists. I don't know it's performance with six elements, but it's worth checking out.

http://www.pengoworks.com/index.cfm?action=qForms



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum