#region Script

   ///<summary>

   ///動態加入javascript

   ///</summary>

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

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

   public static void setScript(Page tP, string innerScript)

   {

       var strFunc = new StringBuilder();

       strFunc.AppendLine(@"<script type='text/javascript'>");

       strFunc.AppendLine(innerScript);

        strFunc.AppendLine(@"</script>");

       tP.Page.ClientScript.RegisterStartupScript(tP.GetType(), Guid.NewGuid().ToString(), strFunc.ToString());

   }

   ///<summary>

   ///取得script字串

   ///</summary>

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

   ///<returns></returns>

   public static string getScriptString(string stR)

   {

       var S = new StringBuilder();

       S.AppendLine("<script type='text/javascript'>");

       S.AppendLine(stR);

       S.AppendLine("</script>");

       return S.ToString();

   }

  

   #endregion

 


arrow
arrow
    文章標籤
    script javascript C# 動態
    全站熱搜

    倧齊 發表在 痞客邦 留言(0) 人氣()