asp.net js 提示信息封装函数

/// <summary>

/// js 提示信息 例子如 只提示信息 可以JavaScript("hell world!")

/// 如果有其他脚本可以JavaScript("alert('hello world!');","document.location='default.aspx';")

/// </summary>

/// <param name="actions"></param>

public void JavaScript(params string[] actions)

{

string action = "";

if (actions.Length > 1)

{

action = string.Format("{0}", string.Join("",actions));

}

else

{

action = string.Format("alert('{0}')", string.Join("", actions));

}

ScriptManager.RegisterClientScriptBlock(this, typeof(string), "key" + new Random().Next(1000), string.Format("<script defer=\"defer\">{0}</script>", action), false);

}