|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <select style="position: relative" size=4> |
|
4 <option>bar</option> |
|
5 </select> |
|
6 <select style="position: relative"> |
|
7 <option>bar</option> |
|
8 </select> |
|
9 <script> |
|
10 function injectAbsPosKid(s) { |
|
11 var option = document.createElement("option"); |
|
12 option.appendChild(document.createTextNode("foo")); |
|
13 option.style.position = "absolute"; |
|
14 option.style.top = "100px"; |
|
15 s.insertBefore(option, s.firstChild); |
|
16 |
|
17 var div = document.createElement("div"); |
|
18 div.appendChild(document.createTextNode("bar")); |
|
19 div.style.position = "absolute"; |
|
20 div.style.top = "200px"; |
|
21 s.appendChild(div); |
|
22 } |
|
23 onload = function() { |
|
24 var s1 = document.querySelectorAll("select")[0]; |
|
25 var s2 = document.querySelectorAll("select")[1]; |
|
26 injectAbsPosKid(s1); |
|
27 injectAbsPosKid(s2); |
|
28 s2.selectedIndex = 0; |
|
29 }; |
|
30 </script> |
|
31 </html> |