5 <select name=
"component" size=
"4">
16 <option selected=selected
>this should be selected
</option>
22 dynamic selected change:
<br>
34 <option id='x'
>this should be selected
</option>
40 document
.getElementById('x').selected
= 'selected';
43 dynamic insert of selected option:
<br>
45 var sel
= document
.createElement('select');
46 sel
.setAttribute('size','4');
47 document
.body
.appendChild(sel
);
48 var opt
= document
.createElement('option')
49 opt
.innerHTML
= 'opt';
51 opt
= document
.createElement('option')
52 opt
.innerHTML
= 'opt';
54 opt
= document
.createElement('option')
55 opt
.innerHTML
= 'opt';
57 opt
= document
.createElement('option')
58 opt
.innerHTML
= 'opt';
60 opt
= document
.createElement('option')
61 opt
.innerHTML
= 'opt';
63 opt
= document
.createElement('option')
64 opt
.innerHTML
= 'opt';
66 opt
= document
.createElement('option')
67 opt
.innerHTML
= 'this should be selected';
68 opt
.selected
= 'selected';
70 opt
= document
.createElement('option')
71 opt
.innerHTML
= 'opt';
76 <select name=
"component" size=
"1">
87 <option selected=selected
>this should be selected
</option>
93 dynamic selected change:
<br>
105 <option id='xx'
>this should be selected
</option>
111 document
.getElementById('xx').selected
= 'selected';
114 dynamic insert of selected option:
<br>
116 var sel
= document
.createElement('select');
117 sel
.setAttribute('size','1');
118 document
.body
.appendChild(sel
);
119 var opt
= document
.createElement('option')
120 opt
.innerHTML
= 'opt';
121 sel
.appendChild(opt
);
122 opt
= document
.createElement('option')
123 opt
.innerHTML
= 'opt';
124 sel
.appendChild(opt
);
125 opt
= document
.createElement('option')
126 opt
.innerHTML
= 'opt';
127 sel
.appendChild(opt
);
128 opt
= document
.createElement('option')
129 opt
.innerHTML
= 'opt';
130 sel
.appendChild(opt
);
131 opt
= document
.createElement('option')
132 opt
.innerHTML
= 'opt';
133 sel
.appendChild(opt
);
134 opt
= document
.createElement('option')
135 opt
.innerHTML
= 'opt';
136 sel
.appendChild(opt
);
137 opt
= document
.createElement('option')
138 opt
.innerHTML
= 'this should be selected';
139 opt
.selected
= 'selected';
140 sel
.appendChild(opt
);
141 opt
= document
.createElement('option')
142 opt
.innerHTML
= 'opt';
143 sel
.appendChild(opt
);