View Code
1 public static MvcHtmlString FckText(this System.Web.Mvc.HtmlHelper helper, string name, string width = "1150", string height = "300")
2 {
3 if (string.IsNullOrEmpty(name))
4 {
5 return MvcHtmlString.Create("name属性为必须");
6 }
7 StringBuilder strBuilder = new StringBuilder();
8 strBuilder.Append("<script tyle=\"text/javascript\">");
9 strBuilder.Append(" var f = new FCKeditor(\"" + name + "\"," + width + "," + height + ");");
10 strBuilder.Append("f.Create();");
11 //strBuilder.Append("f.value='" + value + "'");
12 strBuilder.Append("</script>");
13 return MvcHtmlString.Create(strBuilder.ToString());
14 }
前台调用: @Html.FckText("F_DESC", "600", "300")