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> 

posted @ 2009-11-16 08:13  周骏  阅读(18721)  评论(1编辑  收藏  举报