alertmessage.cs

来自「《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含」· CS 代码 · 共 39 行

CS
39
字号
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// AlertMessage 的摘要描述
/// </summary>
public class AlertMessage
{
	public AlertMessage()
	{
		//
		// TODO: 在此加入构造函数的程序代码
		//
	}

	//显示JavaScript的Alert信息
	public void showMsg(Page thisPage,string AlertMessage)
	{
		Literal txtMsg = new Literal();
		txtMsg.Text = "<script id='theMessage'>alert('" + AlertMessage + "');</script>" + "<BR/>";
		txtMsg.Text +="<script>setTimeout('CleanScript()',1000); function CleanScript(){document.all['theMessage'].outerText='';}</script>";
		thisPage.Controls.Add(txtMsg);
	}

	public void showConfirm(Page thisPage, string AlertMessage)
	{
		Literal txtMsg = new Literal();
		txtMsg.Text = "<script>confirm('" + AlertMessage + "')</script>" + "<BR/>";
		thisPage.Controls.Add(txtMsg);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?