打印A.Href锚点输出

2017-08-13 09:33:03  访问(1683) 赞(0) 踩(0)


        #region 打印A.Href锚点输出

        /// <summary>
        /// 打印A.Href锚点输出
        /// </summary>
        /// <param name="url">URL地址</param>
        /// <param name="theName">锚点名称</param>
        /// <param name="theTitle">title提示文字</param>
        /// <param name="cssClass">样式</param>
        /// <param name="isTargetBlank">是否新窗口</param>
        /// <returns></returns>
        public string AHrefGet
            (
                string url,
                string theName,
                string theTitle,
                string cssClass,
                bool isTargetBlank
            )
        {
            StringBuilder theResult = new StringBuilder();

            theResult.Append("<a ");

            if (url != null && url.Length > 0)
            {
                theResult.Append(" href=\"" + url.Replace("\"", "&quot;") + "\"");
            }

            if (theTitle != null && theTitle.Length > 0)
            {
                theResult.Append(" title=\"" + theTitle.Replace("\"", "&quot;") + "\"");
            }

            if (cssClass != null && cssClass.Length > 0)
            {
                theResult.Append(" class=\"" + cssClass.Replace("\"", "&quot;") + "\"");
            }

            if (isTargetBlank)
            {
                theResult.Append(" target=\"_blank\"");
            }

            theResult.Append(">" + theName + "</a>");

            return theResult.ToString();
        }

        #endregion 打印A.Href锚点输出



上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)