我现在有一个页面,有两个TextBox框体 和 一个Button1
TextBox1 为可编辑,TextBox2只读。要实现的功能:1、当我在TextBox1输入值的时候,TextBox2会自动将TextBox1的值一个一个的输入。
(例如:TextBox1输入一个“A”,TextBox2也出现“A”;当TextBox1再输入第二个字符“B”,TextBox2立刻出现“B”)2、传值完成后,按Button1后,TextBox1和TextBox2把自己的值保存到数据库中。
希望各位大侠,直接把成功的代码发出来,我研究研究。谢谢!
TextBox1 为可编辑,TextBox2只读。要实现的功能:1、当我在TextBox1输入值的时候,TextBox2会自动将TextBox1的值一个一个的输入。
(例如:TextBox1输入一个“A”,TextBox2也出现“A”;当TextBox1再输入第二个字符“B”,TextBox2立刻出现“B”)2、传值完成后,按Button1后,TextBox1和TextBox2把自己的值保存到数据库中。
希望各位大侠,直接把成功的代码发出来,我研究研究。谢谢!
解决方案 »
- (顺便散分)如果取得客户端的显示器的分辨率
- 关于Myshop项目弹出新页面的问题
- detailsview 怎么验证数据最好
- Datagrid的超连接HyperLinkColumn怎样传递两个参数到第二个页面?高手请指教。。。最后70分了
- 谁能说一下MembershipProvider、ProfileProvider和RoleProvider三者的作用及关系?
- 一段10行的代码,居然搞不定了??!
- 菜鸟问题:Asp.net C# 对Access数据库insert 时出错误!
- 关于C#中的"反射"的问题!敬请高手们指点一二。
- 急~!!!请各位大虾帮忙 小弟的毕业设计(关系到毕业的问题)!!!·
- help!在线等
- 关于时间段查询
- JS文件引用也分先后吗?
懒的写了,楼下写吧
function SetValue()
{
document.getElementById("TextBox2").value=document.getElementById("TextBox1").value;
}
</script>
<asp:TextBox ID="TextBox1" runat="server" onkeyup="SetValue()"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" ReadOnly></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(TextBox1.Text);
Response.Write(TextBox2.Text);//如果TextBox2有了ReadOnly属性,这里就获取不到值,要获取到值,必须在html中把ReadOnly去掉。
}
js修改:
function SetValue()
{
document.getElementById("TextBox2").value=document.getElementById("TextBox1").value;
document.getElementById("HiddenField1").value=document.getElementById("TextBox1").value;
}
<asp:TextBox ID="TextBox2" runat="server" ReadOnly></asp:TextBox>function A(s)
{
document.getElementById("TextBox2").value=s;
}
<asp:TextBox ID="TextBox1" runat="server" onkeyup="document.getElementById('TextBox2').value = document.getElementById('TextBox1').value;">
</asp:TextBox><asp:TextBox ID="TextBox2" runat="server" ReadOnly="True"></asp:TextBox>
这两个事件 在我的页面中没有,是什么原因啊。晕了~
function SetValue()
{
document.getElementById("PartSpecField").value = document.getElementById("PartNameField").value
}
</script>
把你的html代码贴出来,我看看你复制的样子。
代码如下: <asp:TextBox ID="TextBox1" runat="server" onpropertychange="SetTb2Value()"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" ReadOnly=true></asp:TextBox>
<script type="text/javascript">
function SetTb2Value()
{
document.getElementById('<%=TextBox2.ClientID%>').value=document.getElementById('<%=TextBox1.ClientID%>').value;
}
</script>
dim tbText2 as string=Me.TextBox2.Text;dim strSQL as string="insert into table(value1,value2)values('"& tbText1 &"','"& tbText2 &"')"
用js写
Button1.click
function SetValue()
{
document.getElementById("PartSpecField").value = document.getElementById("PartNameField").value
}
</script><fb:TextBox ID="PartNameField" runat="server" OnKeyUp="SetValue()"
ReadOnly="false" Style="z-index: 112; left: 211px; position: absolute; top: 197px" />
<fb:TextBox ID="PartSpecField" runat="server"
ReadOnly="true" Style="z-index: 114; left: 419px; position: absolute; top: 197px" />
不就ok 了嚒?
你这是<fb:TextBox,不是<asp:TextBox和input的text
要在后台得到textbox中的值,用request.form["textbox的name"]