OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <style> | 2 <style> |
3 select { | 3 select { |
4 position:absolute; | 4 position:absolute; |
5 top:9px; | 5 top:9px; |
6 left:9px; | 6 left:9px; |
7 height:25px; | 7 height:25px; |
8 width:80px; | 8 width:80px; |
9 } | 9 } |
10 </style> | 10 </style> |
11 <script> | 11 <script> |
12 | 12 |
13 function openSelectMenu(target) { | 13 function focusSelectMenu() { |
14 var evt = document.createEvent("MouseEvents"); | 14 document.querySelector('select').focus(); |
15 evt.initMouseEvent("mousedown", true, true, window); | |
16 document.querySelector('select').dispatchEvent(evt); | |
17 } | 15 } |
18 | 16 |
19 </script> | 17 </script> |
20 <html> | 18 <html> |
21 <body> | 19 <body> |
22 <select> | 20 <select> |
23 <option selected>Apple</option> | 21 <option selected>Apple</option> |
24 <option>Orange</option> | 22 <option>Orange</option> |
25 <option>Banana</option> | 23 <option>Banana</option> |
26 </select> | 24 </select> |
27 </body> | 25 </body> |
28 </html> | 26 </html> |
OLD | NEW |