Javascript examples for DOM HTML Element:Option
Set content to <option> element
<html> <head></head> <body> <select id="MySelectBox"> <option value="1" id="this_year"></option> <option value="2" id="next_year"></option> </select> <script type="text/javascript"> var d = new Date();/* w ww . j a va 2 s . com*/ var x = document.getElementById("this_year"); x.innerHTML=d.getFullYear(); var y = document.getElementById("next_year"); y.innerHTML=d.getFullYear()+1; </script> </body> </html>