gongyu

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

要求步骤,及实现程序。

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;
}

 

posted on 2014-04-23 16:16  gongyu  阅读(239)  评论(0编辑  收藏  举报