<select  onchange="window.alert(this.options[this.selectedIndex].text)">
<option>mmmmmmmmm</option>
<option>nnnnnnnnn</option></select>
value  :this.options[this.selectedIndex].value.............

解决方案 »

  1.   

    如果我在button onClick后进行可以吗
    请写在js里
      

  2.   

    window.alert(document.getElementById('mm').options[document.getElementById('mm').selectededIndex].value);
      

  3.   

    mm是select的id吗,出错了,说这个为空或不是对象(我已经选中了)
      

  4.   

    <button onclick="window.alert(document.form1.sel1.options  [document.form1.sel1.selectedIndex].text)" value="m1" >点击</button>
    <form name="form1">
    <select name="sel1">
    <option>sel1</option>
    <option>sel2</option>
    </select>
    </form>
      

  5.   

    <button onclick="window.alert(document.getElementById('mm').options[document.getElementById('mm').selectedIndex].text)" value="m1" >点击</button>
    <select id="mm">
    <option>sel1</option>
    <option>sel2</option>
    </select>
      

  6.   

    <select id="mm" onchange="alert(this.value)">
    <option>sel1</option>
    <option>sel2</option>
    </select>
      

  7.   

    可以了,谢谢大家,能不能再问一下,怎么在js判断Select里是否有选项被选中
      

  8.   

    selected=true;選中
    selected=false;沒選中
      

  9.   


    for(var i=1;i<slt.options.length;i++) {   //i=1为判定除第一个选择项外是否被选定
     if(slt.options[i].selected==true) return true;
    }
      

  10.   

    太爽啦。。我刚刚遇到不知道怎么判断select的值太谢谢楼上各位啦