javascript实现dropdownlist选中值在textbox无刷新显示问题!就是我在一个页面里有一个 <asp:DropDownList ID="DropDownList1" runat="server" Height="22px" Width="148px">我的页面里面还有个<asp:TextBox ID="txtUpdorDel" runat="server" Height="18px" Width="141px"></asp:TextBox>我想做的就是用javascript实现当我选中dropdownlist里面的某一个值的时候,下面的textbox里面立马显示出所选择的dropdownlist的选项的text,请问这个怎么实现啊,急用啊,求帮助!!!!!

解决方案 »

  1.   

    Jquery写的 
     function a()
          {
         var values=  $("#DropDownList1").val();
         $("#txtUpdorDel").val(values);
          }<asp:DropDownList ID="DropDownList1" runat="server" Height="22px" onchange="a()" Width="148px">
      

  2.   

    服务器端控件到前端显示的时候会有前缀,所以
    可以考虑如此修改
      var values= $("select[id$=DropDownList1]").val();
      $("input[id$=txtUpdorDel]").val(values);
      

  3.   

    var drop=document.getElementById("dropDownList1");
    for(var i=0;i<drop.options.length;i++)
    {
       if(drop.options[i].selected)
    {
      document.getElementById("TextBox1").value=drop.options[i].value;
    }
    }
      

  4.   


    大哥,还是有问题啊,我想要得到的是dropdownlist的选项的text文本啊,不是他的values啊
      

  5.   

    var values= $("select[id$=DropDownList1]").children("option:selected").text();
    $("input[id$=txtUpdorDel]").val(values);
      

  6.   


    大哥,您真乃神人也!!!NNNNNNNNNNNNN