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,请问这个怎么实现啊,急用啊,求帮助!!!!!
function a()
{
var values= $("#DropDownList1").val();
$("#txtUpdorDel").val(values);
}<asp:DropDownList ID="DropDownList1" runat="server" Height="22px" onchange="a()" Width="148px">
可以考虑如此修改
var values= $("select[id$=DropDownList1]").val();
$("input[id$=txtUpdorDel]").val(values);
for(var i=0;i<drop.options.length;i++)
{
if(drop.options[i].selected)
{
document.getElementById("TextBox1").value=drop.options[i].value;
}
}
大哥,还是有问题啊,我想要得到的是dropdownlist的选项的text文本啊,不是他的values啊
$("input[id$=txtUpdorDel]").val(values);
大哥,您真乃神人也!!!NNNNNNNNNNNNN