<select name="test" >第四</option>
</select>

 

js代码:

change(obj){

   //第一种方式:

       for(i=0; i<obj.length; i++){
                if(obj[i].selected){
                    alert(obj[i].innerText) ;
                    break;
              }
       }

  //第二种方式

      var txt = obj.options[obj.selectedIndex].text;

      alert(txt);

}

第二种方式要简便得多

相关文章:

  • 2021-11-20
  • 2022-12-23
  • 2023-02-23
  • 2020-02-18
  • 2021-12-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2021-04-02
  • 2021-10-16
相关资源
相似解决方案