[quote=引用 5 楼 XiaoPeiyuan2020 的回复:] 主要是想实现什么样的功能,说说
。。以前用到的Js类。 /// <summary> /// 客户端脚本输出 /// </summary> public class JsHelper { /// <summary> /// 弹出信息,并跳转指定页面。 /// </summary> public static void AlertAndRedirect(string message, string toURL) { string js = "<script language=javascript>alert('{0}');window.location.replace('{1}')</script>"; HttpContext.Current.Response.Write(string.Format(js, message, toURL)); HttpContext.Current.Response.End(); } /// <summary> /// 弹出信息,并返回历史页面 /// </summary> public static void AlertAndGoHistory(string message, int value) { string js = @"<Script language='JavaScript'>alert('{0}');history.go({1});</Script>"; HttpContext.Current.Response.Write(string.Format(js, message, value)); HttpContext.Current.Response.End(); } /// <summary> /// 直接跳转到指定的页面 /// </summary> public static void Redirect(string toUrl) { string js = @"<script language=javascript>window.location.replace('{0}')</script>"; HttpContext.Current.Response.Write(string.Format(js, toUrl)); } /// <summary> /// 弹出信息 并指定到父窗口 /// </summary> public static void AlertAndParentUrl(string message, string toURL) { string js = "<script language=javascript>alert('{0}');window.top.location.replace('{1}')</script>"; HttpContext.Current.Response.Write(string.Format(js, message, toURL)); } /// <summary> /// 弹出信息 /// </summary> public static void Alert(string message) { string js = "<script language=javascript>alert('{0}');</script>"; HttpContext.Current.Response.Write(string.Format(js, message)); } }
可以在后台执行前台的js或jq语句,调用嘛。。。你见过有后台间接执行js有返回值什么的吗。,。。好像他只是执行,之后都交给前台了
主要是想实现什么样的功能,说说
调用还是执行? 调用不可能, 在生成的html中调用js函数应该是可以的。
不可能的~ 换另外一种思路吧~
110,566
社区成员
642,567
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧