mavro
09-24-2011, 03:24 PM
Hi, I want to set a different value for each name and use url for values.
Can somebody help me with this? :confused:
eg: name A3 and value http://www.audi.com
<script type="text/javascript">
function dynamic1(parent,child){
var parent_array = new Array();
parent_array[''] = ['Please select a manufacturer'];
parent_array['Audi'] = ['A3','A4','A5','A6','A8','Q5','Q7','S3','S4','S5','S6','S8','RS6'];
parent_array['Dacia'] = ['Sandero','Logan'];
parent_array['FIAT'] = ['Bravo','Punto','Grande Punto'];
parent_array['Peugeot'] = ['207','308','407','607'];
parent_array['SEAT'] = ['Ibiza','New Ibiza','Leon'];
parent_array['Skoda'] = ['Fabia','Octavia Tour','Octavia 2','Superb'];
var thechild = document.getElementById(child);
thechild.options.length = 0;
var parent_value = parent.options[parent.selectedIndex].value;
if (!parent_array[parent_value]) parent_value = '';
thechild.options.length = parent_array[parent_value].length;
for(var i=0;i<parent_array[parent_value].length;i++){
thechild.options[i].text = parent_array[parent_value][i];
thechild.options[i].value = parent_array[parent_value][i];} }
</script>
Can somebody help me with this? :confused:
eg: name A3 and value http://www.audi.com
<script type="text/javascript">
function dynamic1(parent,child){
var parent_array = new Array();
parent_array[''] = ['Please select a manufacturer'];
parent_array['Audi'] = ['A3','A4','A5','A6','A8','Q5','Q7','S3','S4','S5','S6','S8','RS6'];
parent_array['Dacia'] = ['Sandero','Logan'];
parent_array['FIAT'] = ['Bravo','Punto','Grande Punto'];
parent_array['Peugeot'] = ['207','308','407','607'];
parent_array['SEAT'] = ['Ibiza','New Ibiza','Leon'];
parent_array['Skoda'] = ['Fabia','Octavia Tour','Octavia 2','Superb'];
var thechild = document.getElementById(child);
thechild.options.length = 0;
var parent_value = parent.options[parent.selectedIndex].value;
if (!parent_array[parent_value]) parent_value = '';
thechild.options.length = parent_array[parent_value].length;
for(var i=0;i<parent_array[parent_value].length;i++){
thechild.options[i].text = parent_array[parent_value][i];
thechild.options[i].value = parent_array[parent_value][i];} }
</script>