aa数据集中的文本框值 [英] textbox values in aa dataset
问题描述
我在文本框中输入值时有2个文本框和标签,然后在另一个文本框中自动显示一个值
引用:我在文本框中输入一个文本框和标签,然后在另一个文本框中自动显示一个值你必须为此编码。您需要使用 JavaScript 在客户端处理TextBox的
onchange
事件,或者在服务器端使用C#或其他东西处理。
重要的是你必须处理该事件,只要TextBox
值发生变化,就会触发该事件。在该事件中,您必须将第一个TextBox
的Text
值分配给第二个TextBox
。
< asp:textbox id = TextBox1 onkeyup = WriteText(); runat = server > < / asp:textbox >
< script type = 文本/ JavaScript的跨度>>
function WriteText()
{
var TextBox1 = 文档跨度> .getElementById(TextBox1中);
var Label1 = document .getElementById(Label1);
Label1.innerText = TextBox1.value;
}
< / script>
i have 2 textbox and labels when enters a values in textbox one then automatically shows a value in another textbox
解决方案Quote:i have 2 textbox and labels when enters a values in textbox one then automatically shows a value in another textbox
You have to code for that. You need to handle the
onchange
Event of TextBox either in client side using JavaScript or at server side using C# or something else.
Important thing is that you have to handle that event, which will be fired whenever theTextBox
value is changed. Inside that event, you have to assign theText
value of the firstTextBox
to the secondTextBox
.
<asp:textbox id="TextBox1" onkeyup="WriteText();" runat="server"></asp:textbox>
<script type="text/javascript"> function WriteText() { var TextBox1= document.getElementById(TextBox1); var Label1= document.getElementById(Label1); Label1.innerText=TextBox1.value; } </script>
这篇关于aa数据集中的文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!