10000太远了,还是近点的用1000,或者100的
后端C#代码
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Asp.NetDemo2 { public partial class DeWebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.txtNum1.Text = "请输入内容"; } protected void btnPass_Click(object sender, EventArgs e) { this.txtNum2.Text = this.txtNum1.Text; } } }
前端代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DeWebForm1.aspx.cs" Inherits="Asp.NetDemo2.DeWebForm1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="txtNum1" runat="server"></asp:TextBox> <br /> <asp:Button ID="btnPass" runat="server" Text="复制到第二个文本框" onclick="btnPass_Click" /> <br /> <asp:TextBox ID="txtNum2" runat="server"></asp:TextBox> </div> </form> </body> </html>
运行效果: