第一种

Page.ClientScript.RegisterStartupScript和Page.ClientScript.RegisterClientScriptBlock

if (txtUsername.Text.Trim() == string.Empty)
{
  Page.ClientScript.RegisterStartupScript(
this.GetType(), "", "alert('收货人,不能为空!');",true);
  
return;
}

 

 

 第二种

Response.Write("<script>alert('收货人,不能为空!');history.go(-1);</script>");

如果缺少 history.go(-1); 样式会乱掉。

if (txtUsername.Text.Trim() == string.Empty)
{
  Response.Write(
"<script>alert('收货人,不能为空!');history.go(-1);</script>");
  
return;
}

相关文章:

  • 2022-02-22
  • 2021-10-25
  • 2021-08-13
  • 2022-12-23
  • 2022-02-19
  • 2021-07-06
  • 2021-12-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案