zoukankan      html  css  js  c++  java
  • 页面跳转类 使用框架集 必备类库

    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; 
    
            }
        }
    }
  • 相关阅读:
    和尚和屠夫
    不要变成自己讨厌的人
    ngnix 反向代理来解决前端跨域问题
    Python 进阶 异步async/await
    Java 基础 多线程和线程池基础
    Java 基础 IO流之序列化
    Python 元类
    selenium 淘宝登入反爬虫解决方案(亲测有效)
    Java 基础 IO流(转换流,缓冲)
    Java 基础 IO流
  • 原文地址:https://www.cnblogs.com/dachie/p/1734400.html
Copyright © 2011-2022 走看看