js获取select的值

Posted 必须往前走

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js获取select的值相关的知识,希望对你有一定的参考价值。

<select   id="tryselect"   name="">   
  <option   value="1">text   1</option>   
  <option   value="2">text   2</option>   
  </select>   
  <script   language="javascript">   
  <!--   
      var   myid   =   document.getElementById("tryselect");   
      alert(myid.options[myid.selectedIndex].value   +"\n"   +myid.options[myid.selectedIndex].text)   
  //-->   
  </script> 










以上是关于js获取select的值的主要内容,如果未能解决你的问题,请参考以下文章