热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

javascript处理类

usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Web;usingSystem.W

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;

///


/// Javascript处理类
///

public class JS
{
    public static void Alert(System.Web.UI.Page p, string message)
    {
        #region
        string js = @"";
        p.RegisterStartupScript("ms", js);
        #endregion
    }

    //弹出提示消息并返回到指定的页面
    public static void AlertAndBack(Page page, string message, string backUrl)
    {
        page.ClientScript.RegisterClientScriptBlock(page.GetType(), "MessageStr", "");
    }

    //从架构返回到指定的页面
    public static void BackToPage(Page page, string backUrl)
    {
        page.ClientScript.RegisterClientScriptBlock(page.GetType(), "MessageStr", "");
    }

    ///


    /// 弹出Javascript小窗口
    ///

    /// 窗口信息
    public static void Alert(string message)
    {
        #region
        string js = @"";
        HttpContext.Current.Response.Write(js);
        #endregion
    }

    ///


    /// 弹出消息框并且转向到新的URL
    ///

    /// 消息内容
    /// 连接地址
    public static void Alert(string message, string toURL)
    {
        #region
        string js = "";
        HttpContext.Current.Response.Write(string.Format(js, message, toURL));
        #endregion
    }

    ///


    /// 弹出消息框并且转向到新的URL
    ///

    /// 消息内容
    /// 连接地址
    public static void AlertReFresh(string message, string toURL)
    {
        #region
        string js = "";
        if (HttpContext.Current.Handler is System.Web.UI.Page)
        {
            ((System.Web.UI.Page)HttpContext.Current.Handler).RegisterStartupScript("ms", js);
        }
        else
        {
            HttpContext.Current.Response.Write(string.Format(js, message, toURL));
        }
        #endregion
    }

    ///


    /// 确定提示
    ///

    ///
    ///
    public static void Confirm(string message, string toURL)
    {
        #region
        string location = "location.href='" + toURL + "';";
        string js = "";

        string ss = string.Format(js, message, location);
        HttpContext.Current.Response.Write(ss);
        #endregion
    }

    ///


    /// 回到历史页面
    ///

    /// -1/1
    public static void GoHistory(int value)
    {
        #region
        string js = @"";
        HttpContext.Current.Response.Write(string.Format(js, value));
        #endregion
    }

    ///


    /// 关闭当前窗口
    ///

    public static void CloseWindow()
    {
        #region
        string js = @"";
        HttpContext.Current.Response.Write(js);
        HttpContext.Current.Response.End();
        #endregion
    }

    ///


    /// 刷新父窗口
    ///

    public static void RefreshParent(string url)
    {
        #region
        string js = @"";
        HttpContext.Current.Response.Write(js);
        #endregion
    }

    ///


    /// 刷新打开窗口
    ///

    public static void RefreshOpener()
    {
        #region
        string js = @"";
        HttpContext.Current.Response.Write(js);
        #endregion
    }

    ///


    /// 打开页面
    ///

    ///
    public static void RedirectPage(string url)
    {
        string js = @"";
        js = string.Format(js, url);
        HttpContext.Current.Response.Write(js);
    }

    ///


    /// 刷新窗体
    ///

    public static void RefreshParentFrame()
    {
        string js = @" ";
        HttpContext.Current.Response.Write(js);

    }

    ///


    /// 打开指定大小的新窗体
    ///

    /// 地址
    ///
    ///
    /// 头位置
    /// 左位置
    public static void OpenWebFormSize(string url, int width, int heigth, int top, int left)
    {
        #region
        string js = @"";

        HttpContext.Current.Response.Write(js);
        #endregion
    }

    ///


    /// 转向Url制定的页面
    ///

    /// 连接地址
    public static void JavascriptLocationHref(string url)
    {
        #region
        string js = @"";
        js = string.Format(js, url);
        HttpContext.Current.Response.Write(js);
        #endregion
    }

    ///


    /// 打开指定大小位置的模式对话框
    ///

    /// 连接地址
    ///
    ///
    /// 距离上位置
    /// 距离左位置
    public static void ShowModalDialogWindow(string webFormUrl, int width, int height, int top, int left)
    {
        #region
        string features = "dialogWidth:" + width.ToString() + "px"
            + ";dialogHeight:" + height.ToString() + "px"
            + ";dialogLeft:" + left.ToString() + "px"
            + ";dialogTop:" + top.ToString() + "px"
            + ";center:yes;help=no;resizable:no;status:no;scroll=yes";
        ShowModalDialogWindow(webFormUrl, features);
        #endregion
    }

    ///


    /// 显示指定大小配置的对话框
    ///

    ///
    ///
    public static void ShowModalDialogWindow(string webFormUrl, string features)
    {
        string js = @"";
        HttpContext.Current.Response.Write(js);
    }

    public static void Xopen(string url)
    {
        string js = @"";
        HttpContext.Current.Response.Write(js);
    }
}

 

转:https://www.cnblogs.com/andy1016/archive/2010/09/07/1820599.html



推荐阅读
author-avatar
游戏fans2012
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有