EDIT – Thanks all – I knew it would be simple…couldn\’t see the wood from the trees!
var abc = new Array(\'Perth\',\'Auckland\');
case \'1\':
document.getElementById(q15).options.length = 0;
for (i = 0; i < abc.length; i++) {
createOption(document.getElementById(q15), abc[i], abc.[i]);
}
break;
I am sure this is easy but I\’m having a mental block.
When the above Javascript outputs a drop down with the values from the array, it produces the following:
<option value=\"Perth\">Perth</option>
<option value=\"Auckland\">Auckland</option>
However, I really need the following:
<option value=\"1\">Perth</option>
<option value=\"2\">Auckland</option>
Where the value= number increments for all the options.
Any ideas?
Thanks,
H.





Rating:
The post javascript – Drop down option incremental values appeared first on Javascript ASK.
via Javascript ASK http://javascriptask.phpfogapp.com/javascript-drop-down-option-incremental-values.html
No comments:
Post a Comment