select and option object
// <option value="bar">foo</option>
var opt = new Option('foo', 'bar')
// to append a option into a select
sel.options[sel.options.length] = opt;
// to append a option into a select, slightly fast
if (!isGecko)
select.add(option);
else
select.appendChild(option);
<select>
<option>foo</option>
<option>foo</option>
<option selected>I'll be selected</option>
<option>foo</option>
<option>foo</option>
</select>
沒有留言:
張貼留言