javascript - drop down list items taken from the java script -


 <select id="mylist" onchange="favbrowser()">   <option> var x</option>  <option> var y</option>     </select>  <script>    var x="google";   var y="firefox";  </script> 

my question , how take option's values javascript

i think ment want fill options script

this can done

<select id="mydropdown">  </select>  <script type="text/javascript">     function filldropdown() {         var ddl = document.getelementbyid('mydropdown');          (var = 1; < 50; i++) {             var mynewoption = new option();             mynewoption.value = i;             mynewoption.text = "my " + i.tostring() + " option...";             ddl.options.add(mynewoption);         }     }      filldropdown(); </script> 

cheers.


Comments