using System; using System.Web; namespace pub.mo { public class js { private js() { } private static string scr_j1 = "<mce:script type=/"text/javascript/"><!-- "; private static string scr_j2 = " // --></mce:script>"; /// <summary> /// 输入js并停止运行 /// </summary> /// <param name="str"></param> public static void write_js(string str) { HttpContext.Current.Response.Write(config.j1); HttpContext.Current.Response.Write(scr_j1); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.Write(scr_j2); HttpContext.Current.Response.Write(config.j2); HttpContext.Current.Response.End(); } /// <summary> /// 输入js,无Response.End() /// </summary> /// <param name="str"></param> public static void write_js1(string str) { HttpContext.Current.Response.Write(config.j1); HttpContext.Current.Response.Write(scr_j1); HttpContext.Current.Response.Write(str); HttpContext.Current.Response.Write(scr_j2); HttpContext.Current.Response.Write(config.j2); } /// <summary> /// 弹出消息框 点确定后history.back(); /// </summary> /// <param name="str"></param> public static void alert(string str) { HttpContext.Current.Response.Write(config.j1); HttpContext.Current.Response.Write(scr_j1); HttpContext.Current.Response.Write("alert('" + str + "');history.back();"); HttpContext.Current.Response.Write(scr_j2); HttpContext.Current.Response.Write(config.j2); HttpContext.Current.Response.End(); } /// <summary> /// /// </summary> /// <param name="str"></param> public static void alert_close(string str) { HttpContext.Current.Response.Write(config.j1); HttpContext.Current.Response.Write(scr_j1); HttpContext.Current.Response.Write("alert('" + str + "');window.close();"); HttpContext.Current.Response.Write(scr_j2); HttpContext.Current.Response.Write(config.j2); HttpContext.Current.Response.End(); } /// <summary> /// 弹出消息框,并跳转 /// </summary> /// <param name="str"></param> /// <param name="path"></param> /// <returns></returns> public static void alert(string str, string path) { HttpContext.Current.Response.Write(config.j1); HttpContext.Current.Response.Write(scr_j1); HttpContext.Current.Response.Write("alert('" + str + "');location.href='" + path + "'"); HttpContext.Current.Response.Write(scr_j2); HttpContext.Current.Response.Write(config.j2); HttpContext.Current.Response.End(); } /// <summary> /// 全屏跳转 /// </summary> /// <param name="str">跳转路径</param> /// <returns></returns> public static void parent(string str) { HttpContext.Current.Response.Write(config.j1); HttpContext.Current.Response.Write(scr_j1); HttpContext.Current.Response.Write("parent.top.location.href='" + str + "';"); HttpContext.Current.Response.Write(scr_j2); HttpContext.Current.Response.Write(config.j2); HttpContext.Current.Response.End(); } /// <summary> /// Confirm /// </summary> /// <param name="str"></param> /// <param name="pPathYes"></param> /// <param name="pPathNo"></param> public static void confirm(string str,string pPathYes,string pPathNo) { HttpContext.Current.Response.Write(config.j1); HttpContext.Current.Response.Write(scr_j1); HttpContext.Current.Response.Write("if(Confirm('" + str + "')){location.href='" + pPathYes + "';}else{location.href='" + pPathNo + "';}"); HttpContext.Current.Response.Write(scr_j2); HttpContext.Current.Response.Write(config.j2); HttpContext.Current.Response.End(); } } }