using System;
using System.Text;

namespace Eyu.Common
{
///
/// 消息提示
///
public abstract class ScriptDAL
{
///
/// 显示一段自定义的输出代码
///
/// 页面指针,一般为This
public static void ResponseScript(System.Web.UI.Page page, string script)
{
StringBuilder sb = new StringBuilder();
sb.Append("");
page.Response.Write(sb.ToString());
}

///
/// 调用客户端JavaScript函数
///
/// 页面指针,一般为This
/// 函数名,带参数,如:FunA(1);
public static void CallClientScript(System.Web.UI.Page page,string scriptName)
{
String csname = "PopupScript";
Type cstype = page.GetType();
System.Web.UI.ClientScriptManager cs = page.ClientScript;
if (!cs.IsStartupScriptRegistered(cstype, csname))
{
String cstext = scriptName;
cs.RegisterStartupScript(cstype, csname, cstext, true);
}
}



}
}
ASP.NET操作JavaScript的类
最新推荐文章于 2025-12-15 15:15:21 发布
本文介绍了一个抽象类ScriptDAL,该类提供了在ASP.NET Web应用程序中执行客户端JavaScript脚本的方法,包括直接输出自定义脚本和注册客户端启动脚本。


745

被折叠的 条评论
为什么被折叠?



