M.W.S.
08-01-2008, 01:53 PM
Hello, I need to make a dynamic 2 level dropdown for auto trading site. It will receive model lists from MySQL. And it will be like on cars.com (makes and models).
I have this piece of JS:
<script type="text/javascript">
var makelist=document.classic.make
var modellist=document.classic.model
var model=new Array()
model[0]=""
model[1]=["A4|A4", "A6|A6", "A8|A8", "TT|TT", "Q7|Q7"]
model[2]=["M3|M3", "M5|M5", "M6|M6", "325|325"]
model[3]=["Enzo|Enzo", "F30|F30", "F50|F50"]
function updatemodel(selectedcitygroup){
modellist.options.length=0
if (selectedcitygroup>0){
for (i=0; i<model[selectedcitygroup].length; i++)
modellist.options[modellist.options.length]=new Option(model[selectedcitygroup][i].split("|")[0], model[selectedcitygroup][i].split("|")[1])
}
}
</script>
So basically, I will need to update this:
model[0]=""
model[1]=["A4|A4", "A6|A6", "A8|A8", "TT|TT", "Q7|Q7"]
model[2]=["M3|M3", "M5|M5", "M6|M6", "325|325"]
model[3]=["Enzo|Enzo", "F30|F30", "F50|F50"]
So, any ideas? :rolleyes:
I have this piece of JS:
<script type="text/javascript">
var makelist=document.classic.make
var modellist=document.classic.model
var model=new Array()
model[0]=""
model[1]=["A4|A4", "A6|A6", "A8|A8", "TT|TT", "Q7|Q7"]
model[2]=["M3|M3", "M5|M5", "M6|M6", "325|325"]
model[3]=["Enzo|Enzo", "F30|F30", "F50|F50"]
function updatemodel(selectedcitygroup){
modellist.options.length=0
if (selectedcitygroup>0){
for (i=0; i<model[selectedcitygroup].length; i++)
modellist.options[modellist.options.length]=new Option(model[selectedcitygroup][i].split("|")[0], model[selectedcitygroup][i].split("|")[1])
}
}
</script>
So basically, I will need to update this:
model[0]=""
model[1]=["A4|A4", "A6|A6", "A8|A8", "TT|TT", "Q7|Q7"]
model[2]=["M3|M3", "M5|M5", "M6|M6", "325|325"]
model[3]=["Enzo|Enzo", "F30|F30", "F50|F50"]
So, any ideas? :rolleyes: