Crispen
09-04-2002, 03:19 AM
Firstly, let me apologize for what I admit is a very thoroughly covered topic. Secondly, I'd like to thank people in advance for helping me with this problem.
Here's my situation:
2 <select> elements. 1 starts with 7 options and is represented with the array galleries[0...6]
the second has a variable number of components each with a "text" and "value" value, each also produces a price so I have built the model like this:
galleries[][][] (where galleries[] represents the value of the first <select> and galleries[][] is only there as a holder so that i can do gallaries[0][0][] = (1, 2, 3, 4, 5) and galleries[0][1][]= (a, b, c, d, e)
so, now we have 2 selects and a 3 dimensional array.
cart is my form name
gallery is <select 1>
item is <select 2>
galleries is the array.
now... here's my problem... this (which is called on "onchange") doesn't work...
function changeLists(){
for(var i = 0; i < 7; i++) {
if (i == document.cart.gallery.options.selectedIndex){
for(var j = 0; j< galleries[i][0].length + 1;) {
document.cart.item.options[j].text = eval(galleries[i][0][j]);
document.cart.item.options[j].text = eval(galleries[i][1][j]);
}
}
}
}
I'm sure I've done something stupid in terms of addressing the option elements. Do they need to be constructed and destroyed? Anyway, I'm sure you wizards will be able to help. Thanks.
Here's my situation:
2 <select> elements. 1 starts with 7 options and is represented with the array galleries[0...6]
the second has a variable number of components each with a "text" and "value" value, each also produces a price so I have built the model like this:
galleries[][][] (where galleries[] represents the value of the first <select> and galleries[][] is only there as a holder so that i can do gallaries[0][0][] = (1, 2, 3, 4, 5) and galleries[0][1][]= (a, b, c, d, e)
so, now we have 2 selects and a 3 dimensional array.
cart is my form name
gallery is <select 1>
item is <select 2>
galleries is the array.
now... here's my problem... this (which is called on "onchange") doesn't work...
function changeLists(){
for(var i = 0; i < 7; i++) {
if (i == document.cart.gallery.options.selectedIndex){
for(var j = 0; j< galleries[i][0].length + 1;) {
document.cart.item.options[j].text = eval(galleries[i][0][j]);
document.cart.item.options[j].text = eval(galleries[i][1][j]);
}
}
}
}
I'm sure I've done something stupid in terms of addressing the option elements. Do they need to be constructed and destroyed? Anyway, I'm sure you wizards will be able to help. Thanks.