You should rename 'attribut' to 'value' in your HTML. You can however define you own attributes and read them too (if validation is of no concern, and for HTML5 you can prefix your custom attribute with 'data-'). Looks like:
<select id="test">
<option value="1" data-attrib="five">test 1</option>
<option value="2" data-attrib="four">test 2</option>
<option value="3" data-attrib="three">test 3</option>
<option value="4" data-attrib="two">test 4</option>
<option value="5" data-attrib="one">test 5</option>
</select>
Now for this select you can get the option values and 'attrib' values with something like:
function getOpts(){
var mySelect = document.getElementById('test')
, opts = mySelect.options
, results = ''
, i=0
, len = opts.length;
while (i<len){
results += opts[i].getAttribute('data-attrib')+'-'+
(opts[i].selected
? 'selected value: '+opts[i].value
: opts[i].value)+'\n';
i++;
}
return '\n'+results;
}
(If you also seek the text value of the option, you can append opts[i].firstChild.nodeValue to the results variable.)