要求步骤,及实现程序。
1、在html中,响应的一个基本单位是表单 form, 表单默认的动作模式是 method="post"
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Style="z-index: 100;
left: 143px; position: absolute; top: 44px" OnTextChanged="TextBox1_TextChanged" onblur="submitform()"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Height="21px" Style="z-index: 102; left: 19px;
position: absolute; top: 45px" Text="前台录入内容" Width="105px"></asp:Label>
<asp:Label ID="Label2" runat="server" Height="21px" Style="z-index: 102; left: 144px;
position: absolute; top: 95px" Width="140px"></asp:Label>
<asp:Label ID="Label3" runat="server" Height="21px" Style="z-index: 102; left: 19px;
position: absolute; top: 99px" Text="显示后台内容" Width="105px"></asp:Label>
</div>
</form>
2、前台程序程序
<!--异步调用后台程序-->
<script type="text/javascript" language="javascript">
function submitform()
{
var myForm=document.forms["form1"];
myForm.action="";
myForm.submit();
}
</script>
3、后台程序
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
Label2.Text = TextBox1.Text;
}