控件</asp:DropDownList><asp:DropDownList ID="ddl3" runat="server">HTML
<select name="ctl00$ContentPlaceHolder1$ddl3" id="ctl00_ContentPlaceHolder1_ddl3">
<option selected="selected" value="17">k1</option>
<option value="18">k2</option>
<option value="19">k2</option>
</select>我用很多方法都只能选到value里的值(17,18...),如果我要选择k1或k2之类的文字值要用什么方法选.谢谢各位.

解决方案 »

  1.   

    大哥们 看清楚 人家是HTML 控件
    你这么写试试
    this.options[this.selectedIndex].text
    this.options[this.selectedIndex].value
      

  2.   

    DropDownList1.Items.FindByText("k1").Selected = true;
      

  3.   

    控件</asp:DropDownList><asp:DropDownList ID="ddl3" runat="server">
    这个控件当摆设啊!
    2
      

  4.   

    DropDownList1.SelectedItem.Text
    DropDownList1.SelectedItem.Value
      

  5.   

    cs:ddl3.SelectedItem.Text;
    js:
    document.all.ctl00_ContentPlaceHolder1_ddl3.value;
    or 
    var o=document.all.ctl00_ContentPlaceHolder1_ddl3;
    o.options[o.selectedIndex].value;
    ->document.all or document.getElementById("") can work
      

  6.   

    去掉value="18",value="19",需要用时用得到的值k1,k2...进行判断。
      

  7.   

    改成这样
    <asp:DropDownList id="DropDownList1" runat="server">
    <asp:ListItem Selected="True" Value="17"> k1 </asp:ListItem>
    </asp:DropDownList>
    代码获的
    DropDownList1.SelectedItem.Text ;
      

  8.   

    zwwlovezy1() ( ) 信誉:100  2007-07-20 13:58:59  得分: 0  
     
    大哥们 看清楚 人家是HTML 控件
    你这么写试试
    this.options[this.selectedIndex].text
    this.options[this.selectedIndex].value
    ------------------------------------------------------------哥们太搞笑了,上面这句话连ID都没,能出结果???
    写个脚本
    function GetValue()
    {
      
      var oSel=document.getElementById("ddl3");
      var oValue="";
      if(oSel!=null)
        {
              oValue=oSel.options[oSel.selectedIndex].value
        }
    }
      

  9.   

    <asp:DropDownList id="DropDownList1" runat="server">
    这是ASP.NET取值是 DropDownList1.selectedvalue
    ---------------------------------------------------------<select name="ctl00$ContentPlaceHolder1$ddl3" id="ctl00_ContentPlaceHolder1_ddl3">
    <option selected="selected" value="17">k1</option>
    <option value="18">k2</option>
    <option value="19">k2</option>
    </select>
    这段是ASP...this.options[this.selectedIndex].text
    this.options[this.selectedIndex].value