var a=document.getElemetsByTagName("select")
alert(a[a.length-1].value)
alert(a[a.length-1].text)
alert(a[a.length-1].options.length)
alert(a[a.length-1].options[0].value)
alert(a[a.length-1].options[0].text)

解决方案 »

  1.   

    var obj = document.getElementById("select"+num);
    var txt = obj.options[obj.selectedIndex].value;
      

  2.   


    <select id = 'sel'>
       <option value = "test1">test11</option>
       <option value = "test2">test22</option>
       <option value = "test3">test33</option>
    </select><script>
       function ss()
       {
           obj = document.getElementById('sel');
           alert(obj.options[obj.options.length-1].value);// 弹出最后一项的value值
           alert(obj.options[obj.options.length-1].text);// 弹出最后一项的文本值
       }
    </script>