页面上,一个Dropdowmlist,一个textbox,两个都是服务器控件.
一个按钮是html控件.
我想点击按钮,使得textbox的值等于Dropdowmlist的选中的项的值.
我想在前台完成,请问这个js语句怎么写????
一个按钮是html控件.
我想点击按钮,使得textbox的值等于Dropdowmlist的选中的项的值.
我想在前台完成,请问这个js语句怎么写????
解决方案 »
- 两个Repeater嵌套,如何获取里面的控件
- FormView 在编辑状态时,点击更新时没有任务反应是什么回事呀!?
- C#中怎么判断字符串A中是否含有字符B
- Repeater itemDataBound(急)对的马上给分
- 请问:如何在VS2003中使用GridView控件?
- 帮我看看这段代码(简单 但我不会)在线等
- C#可以做ActiveX控件吗?该控件可以被Html调用,从而用来调用客户端的本地应用程序。
- ajax从数据库中读出的数据为什么构造成xml代码后,格式变了,换行、空格之类的都没了。怎么办?
- 高手来啊!怎么把一个非序列化的对象序列化然后保存到SESSION中!
- dropdownlist 选中的值不能改变
- 请教诸位一个小问题
- 我用WebRequest获取的远程页面的HTML代码,怎么有乱码呀?
{
document.all.textbox的id.value = document.all.Dropdownlist的id.value
}
这个不可以的,大家帮忙想一想
<HTML>
<HEAD>
<title>WebForm1</title>
<script language="">
function HaddlesButton()
{
document.getElementById("TextBox1").value=document.getElementById("DropDownList1").value;
}
function HaddlesDropDownList(obj)
{
document.getElementById("TextBox1").value=obj.value;
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 200px; POSITION: absolute; TOP: 240px"
runat="server">
<asp:ListItem Value="1">1111111111111111</asp:ListItem>
<asp:ListItem Value="2">2222222222222222</asp:ListItem>
<asp:ListItem Value="3">3333333333333333</asp:ListItem>
</asp:DropDownList>
<asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 200px; POSITION: absolute; TOP: 192px"
runat="server"></asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 103; LEFT: 416px; POSITION: absolute; TOP: 240px"
runat="server" Text="Button"></asp:Button>
</form>
</body>
</HTML>.vb:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
DropDownList1.Attributes.Add("onchange", "HaddlesDropDownList(this);")
Button1.Attributes.Add("onclick", "HaddlesButton();")
End If
End Sub