这让我很沮丧。我试过了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
txtDrugList.Focus();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (txtDrugList.Text.Length > 0)
{
drugDiv.InnerHtml += txtDrugList.Text + " ";
Response.Write("\n");
}
txtDrugList.Text = "";
}
}
和
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
txtDrugList.Focus();
}
protected void Button1_Click(object sender, EventArgs e)
{
if (txtDrugList.Text.Length > 0)
{
drugDiv.InnerHtml += txtDrugList.Text + Environment.NewLine;
}
txtDrugList.Text = "";
}
}
也不工作。我想要一个按钮单击将换行符添加到 div。为什么这不起作用?