Another approach is to use multidimensional arrays:
var driversCounter = [ ["one", 1], ["two", 2], ["three", 3], ["four", 4], ["five", 5] ]
and access the value using driverCounter [k] [j], where j = 0.1 in the case.
Add it to the drop-down list:
var dd = document.getElementById('your_dropdown_element'); for(i=0;i<driversCounter.length-1;i++) { dd.options.add(opt); opt.text = driversCounter[i][0]; opt.value = driversCounter[i][1]; }
shiraz May 18 '12 at 15:10 2012-05-18 15:10
source share