页面跳转类 使用框架集 必备类库
2010-05-13 12:51
363 查看
using System; using System.Data; namespace Dachie.Common { /// <summary> /// 页面跳转类 /// </summary> public abstract class Message { public Message() { // // TODO: 在此处添加构造函数逻辑 // } /// <summary> /// 提示信息并返回 /// </summary> /// <param name="word">提示信息</param> public static void back(string word) { System.Web.HttpContext.Current.Response.Write("<script language='javascript'>"); System.Web.HttpContext.Current.Response.Write("alert('" + word + "');"); System.Web.HttpContext.Current.Response.Write("history.back();"); System.Web.HttpContext.Current.Response.Write("</script>"); } /// <summary> /// 刷新左则框架 /// </summary> /// <param name="word">框架名</param> public static void ShowAndReLoad(string word, string rurl) { System.Web.HttpContext.Current.Response.Write("<script language='javascript'>"); System.Web.HttpContext.Current.Response.Write("alert('" + word + "');"); System.Web.HttpContext.Current.Response.Write("self.location='" + System.Web.HttpContext.Current.Request.UrlReferrer.ToString() + "';parent.leftFrame.location.href='" + rurl + "';"); System.Web.HttpContext.Current.Response.Write("</script>"); } /// <summary> /// 刷新左则框架 /// </summary> /// <param name="word">框架名</param> public static void ShowAndReLoad(string word, string url, string rurl) { System.Web.HttpContext.Current.Response.Write("<script language='javascript'>"); System.Web.HttpContext.Current.Response.Write("alert('" + word + "');"); System.Web.HttpContext.Current.Response.Write("self.location='" + url + "';parent.leftFrame.location.href='" + rurl + "';"); System.Web.HttpContext.Current.Response.Write("</script>"); } /// <summary> /// 提示信息并跳转 /// </summary> /// <param name="word">提示信息</param> /// <param name="url">跳转页面</param> public static void Show(string word, string url) { System.Web.HttpContext.Current.Response.Write("<script language='javascript'>"); System.Web.HttpContext.Current.Response.Write("alert('" + word + "');"); System.Web.HttpContext.Current.Response.Write("self.location='" + url + "';"); System.Web.HttpContext.Current.Response.Write("</script>"); } /// <summary> /// 提示信息并跳转至上次请求页面 /// </summary> /// <param name="word">提示信息</param> public static void Show(string word) { System.Web.HttpContext.Current.Response.Write("<script language='javascript'>"); System.Web.HttpContext.Current.Response.Write("alert('" + word + "');"); System.Web.HttpContext.Current.Response.Write("self.location='" + System.Web.HttpContext.Current.Request.UrlReferrer.ToString() + "';"); System.Web.HttpContext.Current.Response.Write("</script>"); } /// <summary> /// 提示信息并从父窗口跳转 /// </summary> /// <param name="word">提示信息</param> /// <param name="url">跳转页面</param> public static void to_parent(string word, string url) { System.Web.HttpContext.Current.Response.Write("<script language='javascript'>"); System.Web.HttpContext.Current.Response.Write("alert('" + word + "');"); System.Web.HttpContext.Current.Response.Write("parent.location='" + url + "';"); System.Web.HttpContext.Current.Response.Write("</script>"); } /// <summary> /// 从父窗口跳转 /// <param name="url">跳转页面</param> public static void to_parent(string url) { System.Web.HttpContext.Current.Response.Write("<script language='javascript'>"); System.Web.HttpContext.Current.Response.Write("parent.location='" + url + "';"); System.Web.HttpContext.Current.Response.Write("</script>"); } /******************取字符串**************************/ /// <summary> /// 截断字符串 /// </summary> /// <param name="str">字符串</param> /// <param name="num">长度</param> /// <returns>结果</returns> public static string getNumstring(string str, int num) { string nstr = ""; //byte[] mybyte = System.Text.Encoding.Default.GetBytes(str); //认为中文长度为2 int len = str.Length; if (len > num) { nstr = str.Substring(0, num); } else { nstr = str; } return nstr; } } }
相关文章推荐
- 使用ifram框架造成页面跳转混乱小记录
- IE (6-11)版本,在使用iframe的框架时,通过a标签javascript:; 和js跳转parent.location的时候 出现在新页面打开的情况
- 使用ifram框架造成页面跳转混乱小记录
- 使用框架页面的跳转
- Iframe浮动框架中使用超链页面跳转问题
- servlet使用request跳转到jsp页面指定的框架
- 使用框架页面的跳转 转
- 使用iframe框架时,子页面内跳转整个页面
- java web开发中,jsp使用了frameset框架,如何实现整个页面跳转,并且同一个表单中可以提交两个action
- PHP使用frameset制作后台界面时,怎样实现通过操作左边框架,使右边框架中的页面跳转?
- 使用iframe框架后的页面跳转时目标页面变为iframe的子页面的问题
- 使用iframe框架后的页面跳转时目标页面变为iframe的子页面的问题
- jquery mobile框架,用超链接定位到其他页面,会出现不能跳转或者跳转后页面js代码不能执行现象
- 使用JavaScript在页面中进行跳转
- 基于MVC4+EasyUI的Web开发框架经验总结(11)--使用Bundles处理简化页面代码
- 安卓页面跳转使用Context.startActivity注意事项
- 解决微信小程序使用switchTab跳转后页面不刷新的问题
- 使用thinkphp时因为一个’/‘造成页面一直跳转
- 使用Ext JS,不要使用页面做组件重用,尽量不要做页面跳转
- Vue 爬坑之路(三)—— 使用 vue-router 跳转页面