解决方案 »

  1.   

    调用还是执行?调用不可能,在生成的html中调用js函数应该是可以的。
      

  2.   

    主要就是实现我前台有一个HTML转换PDF的方法。我想在后台执行这个方法
      

  3.   

    可以在后台执行前台的js或jq语句,调用嘛你见过有后台间接执行js有返回值什么的吗。,。。好像他只是执行,之后都交给前台了
      

  4.   

    no way
    换思路
    可以js post,返回结果后再执行想调用的方法
      

  5.   

        。。以前用到的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));
            }    }
      

  6.   

    主要就是实现我前台有一个HTML转换PDF的方法。我想在后台执行这个方法感觉浏览器环境中js还没有厉害到可以把html转pdf,估计是 C#的html转pdf,
    你可以把html传给后台~
    后台处理后在输出pdf
      

  7.   

    web服务是无法主动发送消息到浏览器的。你可以把要生成PDF的数据传到后台去,然后生成PDF再响应回浏览器。