ASP.NET----ページスクリプト静的操作クラス

2020 ワード

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Web.UI;



namespace Core.Common.UI

{

    /// <summary>

    ///             

    /// </summary>

    public static class Script

    {

        #region     



        /// <summary>

        ///            

        /// </summary>

        /// <param name="msg">      </param>

        /// <param name="page">     </param>

        public static void Alert(string msg, Page page)

        {

            page.ClientScript.RegisterClientScriptBlock(page.GetType(), "alert", "<script type='text/javascript'>alert('" + msg + "')</script>");

        }



        /// <summary>

        ///            

        /// </summary>

        /// <param name="name">

        ///      

        ///                     ,         

        /// </param>

        /// <param name="msg">      </param>

        /// <param name="page">     </param>

        public static void Alert(string name, string msg, Page page)

        {

            page.ClientScript.RegisterClientScriptBlock(page.GetType(), name, "<script type='text/javascript'>alert('" + msg + "');</script>");

        }



        /// <summary>

        ///           

        /// </summary>

        /// <param name="name">     </param>

        /// <param name="cmd">      </param>

        /// <param name="page">     </param>

        public static void JsExe(string name, string cmd, Page page)

        {

            page.ClientScript.RegisterClientScriptBlock(page.GetType(), name, "<script type='text/javascript'>" + cmd + ";</script>");

        }



        #endregion

    }

}